Labels

Arduino (1) Brainf**k (1) Bugs (3) C (1) HTML (1) Install (3) Linux (27) Maths (1) Python (12) 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 tnx.nl/ip 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.
#!/bin/sh


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


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