如何从Shell中快速获得出口IP

通过DNS协议(UDP)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
dig +short myip.opendns.com @resolver4.opendns.com
dig +short myip.opendns.com @resolver4.opendns.com
dig +short myip.opendns.com @resolver4.opendns.com

通过HTTP服务(TCP)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
curl -s http://whatismyip.akamai.com/
curl -s http://whatismyip.akamai.com/
curl -s http://whatismyip.akamai.com/

 

Leave a Reply

Your email address will not be published. Required fields are marked *