linux怎么查看自己的公网ip

   2024-10-25 5920
核心提示:有多种方法可以查看Linux系统的公网IP地址,以下是其中一些常用的方法:使用curl命令查询公网IP地址:curl ifconfig.me使用dig命

有多种方法可以查看Linux系统的公网IP地址,以下是其中一些常用的方法:

使用curl命令查询公网IP地址:
curl ifconfig.me
使用dig命令查询公网IP地址:
dig +short myip.opendns.com @resolver1.opendns.com
使用wget命令查询公网IP地址:
wget -qO- icanhazip.com
使用nslookup命令查询公网IP地址:
nslookup myip.opendns.com resolver1.opendns.com
使用ip命令查询公网IP地址:
ip addr show eth0 | grep inet | awk '{print $2}' | cut -d/ -f1

以上方法中,eth0是网络接口的名称,你可以根据自己的网络配置修改为实际使用的网络接口名称。

 
举报打赏
 
更多>同类网点查询
推荐图文
推荐网点查询
点击排行

网站首页  |  关于我们  |  联系方式网站留言    |  赣ICP备2021007278号