Posts tagged How can I get my external IP address from behind a NAT?

How to find the External IP if it is Natted

If you are behind a NAT  and want to  find the real / external IP from  the server then execute one of the below command from the server ::

[email protected][#] curl -s http://checkip.dyndns.org | html2text | awk -F ':' '{print $2}'

or

[email protected][#] curl http://icanhazip.com/

or

[email protected][#] curl http://myexternalip.com/raw

or

[email protected][#] curl  ifconfig.me

The last one is a bit slower but it does show the external IP.

If you want to get the natted IP  for secondary interfaces that is eth0:1 , eth0:2  then use curl –interface IP curlmyip.com

ex :

curl --interface 172.16.0.75 curlmyip.com
10.10.10.11

 

That’s all.