学无先后,达者为师

网站首页 编程语言 正文

linux查看外网ip的5种方法

作者:程序员小猪。 更新时间: 2024-01-16 编程语言

在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}'

原文链接:https://itdream.blog.csdn.net/article/details/134420753

  • 上一篇:没有了
  • 下一篇:没有了
栏目分类
最近更新