Linux (28) Python (13) Raspberry Pi (5) Bugs (3) Install (3) C (2) Brainf**k (1) HTML (1) Maths (1) Sorts (1)

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"

No comments:

Post a comment