我正在解决我们的 2 接口 centos 机器上的一些网络问题。该机器有两个接口,分别用于 162.* 和 172.* 子网。该机器曾经工作正常,但截至今天,我只能访问 162.* 子网内的机器,无法访问 172.* 中的机器。我注意到 ipconfig 显示 172.* 接口,其中包含“scopeid 0x20”而不是 IP 地址。
ifconfig-a
eno16777984: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 162.70.42.93 netmask 255.255.255.0 broadcast 162.70.42.255
ether 00:50:56:ba:b0:83 txqueuelen 1000 (Ethernet)
RX packets 1935793 bytes 195710508 (186.6 MiB)
RX errors 0 dropped 16501 overruns 0 frame 0
TX packets 638906 bytes 47382225 (45.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno33557248: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::250:56ff:feba:6875 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:ba:68:75 txqueuelen 1000 (Ethernet)
RX packets 147161 bytes 8837081 (8.4 MiB)
RX errors 0 dropped 639 overruns 0 frame 0
TX packets 8098 bytes 1436275 (1.3 MiB)
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
loop txqueuelen 0 (Local Loopback)
RX packets 318746 bytes 17084987 (16.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 318746 bytes 17084987 (16.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
第二个接口 eno33557248 显示“scopeid 0x20”,而不是 IP。
该接口位于 /etc/sysconfig/network-scripts/ifcfg-eno33557248 下。文件内容如下:
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
IPV6INIT="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME=eno33557248
UUID="e157d343-3acb-4498-8ab2-83251bf5e098"
ONBOOT="yes"
HWADDR=00:50:56:BA:68:75
IPADDR=172.16.3.2
PREFIX=24
GATEWAY=172.16.3.1
该文件多年来没有改变,并且机器曾经正常工作。我不知道为什么 172.* 界面显示“scopeid 0x20”而不是 IP,也不知道它的含义,但 172.* 子网的问题让我相信它有问题。如果是这样,我该如何修复这个界面?
Update1:ip链接的输出:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno16777984: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
link/ether 00:50:56:ba:b0:83 brd ff:ff:ff:ff:ff:ff
3: eno33557248: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
link/ether 00:50:56:ba:68:75 brd ff:ff:ff:ff:ff:ff
Update2:另一个接口文件ifcfg-eno16777984的内容
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777984"
UUID="e157d343-3acb-4498-8ab2-83251bf5e098"
ONBOOT="yes"
HWADDR="00:50:56:BA:B0:83"
DNS1="162.70.113.10"
DNS2="162.70.113.11"
IPADDR=162.70.42.93
PREFIX=24
GATEWAY=162.70.42.1
ZONE=public
Update3:ip路由的输出。注意 172.* 不在列表中。
default via 162.70.42.1 dev eno16777984 proto static metric 100
162.70.42.0/24 dev eno16777984 proto kernel scope link src 162.70.42.93 metric 100