我附加了两个选项net.ifnames=0
biosdevname=0
grub2
因为我想在RHEL 7上将默认networking名称更改为旧名称eth0
。
之后,我编辑/etc/sysconfig/network
来设置机器的默认网关:
GATEWAY=192.168.88.1
并configurationnetworking接口。 当我只有一个networking接口eth0
,一切正常。
这里是一个networking接口eth0
的路由表:
[root@devmachine ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.88.1 0.0.0.0 UG 100 0 0 eth0 192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0 [root@devmachine ~]#
但是我在路由表中遇到了多个networking接口在线的问题。
[root@devmachine ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.88.1 0.0.0.0 UG 100 0 0 eth0 0.0.0.0 192.168.88.1 0.0.0.0 UG 101 0 0 eth1 172.168.0.0 0.0.0.0 255.255.0.0 U 100 0 0 eth1 192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0 192.168.88.1 0.0.0.0 255.255.255.255 UH 100 0 0 eth1 [root@devmachine ~]#
正如你所看到的,网关地址192.168.88.1
被添加到最后一行的eth1
。 网关地址连续添加新的networking接口。
[root@devmachine network-scripts]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.88.1 0.0.0.0 UG 100 0 0 eth0 default 192.168.88.1 0.0.0.0 UG 101 0 0 eth1 default 192.168.88.1 0.0.0.0 UG 102 0 0 eth2 172.168.0.0 0.0.0.0 255.255.0.0 U 100 0 0 eth1 172.168.0.0 0.0.0.0 255.255.0.0 U 101 0 0 eth2 192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0 192.168.88.1 0.0.0.0 255.255.255.255 UH 100 0 0 eth1 192.168.88.1 0.0.0.0 255.255.255.255 UH 101 0 0 eth2
其实,只有当我附加选项net.ifnames=0
grub2
的问题才出现。 有人帮助我。
我认为这可能是由于缺少ifcfg-eth1
# cd /etc/sysconfig/network-scripts # cp ifcfg-eth0 ifcfg-eth1