前提:服务器有四块网卡,信息如下所示:
[root@RedOS-LE-23 ~]# ipaddr|grep net
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.1.150/24 brd 192.168.1.255scope global dynamic enP3p9s0f0
inet6 fd00:1:1:1:42f2:e9ff:fe5c:b5bc/64scope global dynamic
inet6 fe80::42f2:e9ff:fe5c:b5bc/64 scopelink
inet 192.168.1.104/24 brd 192.168.1.255scope global dynamic enP3p9s0f1
inet6 fd00:1:1:1:42f2:e9ff:fe5c:b5bd/64scope global dynamic
inet6 fe80::42f2:e9ff:fe5c:b5bd/64 scopelink
inet 192.168.1.118/24 brd 192.168.1.255scope global dynamic enP3p9s0f2
inet6 fd00:1:1:1:42f2:e9ff:fe5c:b5be/64scope global dynamic
inet6 fe80::42f2:e9ff:fe5c:b5be/64 scopelink
inet 192.168.1.23/24 brd 192.168.1.255scope global br0
inet6 fe80::42f2:e9ff:fe5c:b5bf/64 scopelink
inet 192.168.122.1/24 brd 192.168.122.255scope global virbr0
9:vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast masterbr0 state UNKNOWN qlen 500
inet6fe80::fc54:ff:fe87:d8a/64 scope link
写此文章的目的:23服务器有四块网卡,都插有网线并连接交换机,重启后自动分配地址。但是发现.23ping不通。原因是路由表main表,有多条路由规则,23这个IP是br0的IP,在规则表中第四条,不被优先匹配。路由表有多条同网段但不通出口的路由,会优先匹配第一条。所以23不通。路由表信息如下所示:
[root@RedOS-LE-23 cjxlvdir]# route -n
KernelIP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 enP3p9s0f0
0.0.0.0 192.168.1.1 0.0.0.0 UG 101 0 &