有多种方法可以查看Linux系统的公网IP地址,以下是其中一些常用的方法:
curl ifconfig.me
dig +short myip.opendns.com @resolver1.opendns.com
wget -qO- icanhazip.com
nslookup myip.opendns.com resolver1.opendns.com
ip addr show eth0 | grep inet | awk '{print $2}' | cut -d/ -f1
以上方法中,eth0是网络接口的名称,你可以根据自己的网络配置修改为实际使用的网络接口名称。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
相关推荐:如何查看云服务器的公网ip地址