Linux-Noob Forums

Full Version: easily get your WAN IP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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"]; ?>