How to check wan ip from Linux command prompt

centos7

#1

I need to find out my wan IP address from Linux command prompt. My modem changes IP address every day. Is it possible to use Linux command to get wan IP address?


#2

Try the following commands to get your public IP address assigned by your ISP to your router:

dig +short myip.opendns.com @resolver1.opendns.com

OR

dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

OR

host myip.opendns.com resolver1.opendns.com

See