KING 博主等级

一帆风顺 ⛵️⛵️⛵️

CentOS查看内网和外网IP

钟晓川
2023-08-28 / 3 点赞 / 2607 阅读
ifconfig -a

输出结果

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.113.48  netmask 255.255.0.0  broadcast 10.0.255.255
        inet6 fe80::216:3eff:fe37:e2e8  prefixlen 64  scopeid 0x20<link>
        ether 00:16:3e:37:e2:e8  txqueuelen 1000  (Ethernet)
        RX packets 312803270  bytes 169615014121 (157.9 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 180917283  bytes 283195682260 (263.7 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 17122148  bytes 44025632947 (41.0 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17122148  bytes 44025632947 (41.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0****

查看外网IP地址

curl ifconfig.me
3