最新消息:欢迎来到我的小站

linux查看内网/外网ip

linux Terry 19浏览 0评论

使用ifconfig命令:

[[email protected] ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 94.*.*.68  netmask 255.255.255.0  broadcast 94.*.*.255
        inet6 fe80::216:3cff:fecf:a9f9  prefixlen 64  scopeid 0x20<link>
        inet6 2a00:1838:35:177::b36a  prefixlen 64  scopeid 0x0<global>
        ether 00:16:3c:cf:a9:f9  txqueuelen 1000  (Ethernet)
        RX packets 723475087  bytes 58210963050 (54.2 GiB)
        RX errors 0  dropped 61  overruns 0  frame 0
        TX packets 27151254  bytes 59928548107 (55.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 800914  bytes 439836184 (419.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 800914  bytes 439836184 (419.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

一般eth0会显示内网ip(如:192.168.*.*),如果你本身有公网ip这里显示的就是公网ip。

如果本机没有公网ip则通过如下命令查看:

curl ifconfig.me

 

转载请注明:Terry's blog » linux查看内网/外网ip

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址