在Linux系统中,有多种方法可以查看外网IP地址。下面将介绍5种常用的方法:
curl ifconfig.me
wget -q0- ifconfig.me
dig +short myip.opendns.com @resolver1.opendns.com
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
ifconfig eth0 | grep "inet " | awk '{print $2}'