我附加了两个选项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时,问题才出现。 有人帮助我。
你必须添加
DEFROUTE=no
给所有不应该有默认路由的接口。 在你的情况下,将DEFROUTE=no添加到/etc/sysconfig/network-scripts/ifcfg-eth1应该可以做到这一点。
或者,不要在/etc/sysconfig/network中设置GATEWAY ,而是可以在/etc/sysconfig/network-scripts/route-eth0设置它。 即
echo 0.0.0.0/0 via 192.168.88.1 > /etc/sysconfig/network-scripts/route-eth0
您可以参考RHEL 7networking指南
顺便说一句,我相信你的问题与你用grubconfiguration做什么没有关系。