Arduino (1) Bugs (3) C (1) Install (3) Linux (25) Maths (1) Python (11) Raspberry Pi (4)

Tuesday, 21 July 2015

How to find out the your WAN address using the command line.

A WAN address is the IP address that the router uses to connect to the internet and it is shared by all of the devices on that LAN network.

We are going to be using to get our IP as this just sends the IP in plain format so its easy to read.

Now lets create a script to get our IP.

Line 1:
This tells the shell to use the sh interpreter.

Line 2:
This gets you IP using wget and and stores it in the variable myIP
myIP=`wget -qO-`

Line 3:
This prints out your IP address.
echo "Current IP address is: $myIP"