0


linux查看外网ip的5种方法

在Linux系统中,有多种方法可以查看外网IP地址。下面将介绍5种常用的方法:

方法1:使用curl命令

curl ifconfig.me

方法2:使用wget命令

wget -q0- ifconfig.me

方法3:使用dig命令

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

方法4:使用ip命令

ip addr show eth0 |grep inet |awk'{ print $2; }'|sed's/\/.*$//'

方法5:使用ifconfig命令

ifconfig eth0 |grep"inet "|awk'{print $2}'
标签: linux tcp/ip 运维

本文转载自: https://blog.csdn.net/zmzwll1314/article/details/134420753
版权归原作者 程序员小猪。 所有, 如有侵权,请联系我们删除。

“linux查看外网ip的5种方法”的评论:

还没有评论