Linux-Noob Forums
easily get your WAN IP - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: Tips and Tricks (https://www.linux-noob.com/forums/forum-59.html)
+--- Thread: easily get your WAN IP (/thread-2551.html)



easily get your WAN IP - hijinks - 2005-07-14


this was just asked in the IRC channel.. he was wondering if there was a easy way in shell to get the external IP address if you are behind a router. well there is. I setup a very simple php page to report back your IP.. so if you run

 



Code:
IP=`wget -q -O - http://homer.meso.com/remoteip.php`
echo $IP




 

You should get your IP address back.. here is the 1 liner php script if anyone wants to run their own

 

 



Code:
<? echo $_SERVER["REMOTE_ADDR"]; ?>