18.04:使用 IP 查找命令行找到不同的 IP 地址

18.04:使用 IP 查找命令行找到不同的 IP 地址

我正在 Ubuntu 18.04 LTS 中执行以下操作:

ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.208.65  netmask 255.255.255.240  broadcast 172.17.208.79
        ether 00:15:5d:c0:71:38  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.120.0.134  netmask 255.255.255.252  broadcast 10.120.0.135
        ether 00:ff:e2:51:de:11  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.75.1  netmask 255.255.255.240  broadcast 10.0.75.15
        ether 00:15:5d:25:96:00  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 1500
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0xfe<compat,link,site,host>
        loop  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.68  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 60:03:08:9b:2c:d2  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0 

和:

curl ifconfig.me
xx.xx.xxx.xxx

为什么 IP 不匹配,eth0 和/或 wifi0 不应该与 ifconfig.me 相同吗?

答案1

不,ethXotwifi不应该总是匹配curl ifconfig.me

71.19.252.146是您的真实互联网地址,但10.x.x.x地址是本地的。

你已连接到某个路由器(本地或 ISP 管理),该路由器使用以下方式转换地址NAT

相关内容