How to find the External IP if it is Natted

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:

[code]root@server[#] curl -s http://checkip.dyndns.org | html2text | awk -F ‘:’ ‘{print $2}'[/code]

[code]root@server[#] curl http://icanhazip.com/[/code]

[code]root@server[#] curl http://myexternalip.com/raw[/code]

[code]root@server[#] curl  ifconfig.me[/code]

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

[code]curl --interface 128.199.95.95 curlmyip.com[/code]

By anup