fedora-sysv / initscripts

📜 Scripts to bring up network interfaces and legacy utilities in Fedora.
GNU General Public License v2.0
45 stars 51 forks source link

Consult about route contention #456

Open gaoxingwang opened 1 year ago

gaoxingwang commented 1 year ago

When I use the following configuration, restart the network service.

Configuration content: /etc/sysconfig/network-scripts/ifcfg-eth2

STARTMODE='onboot'
BOOTPROTO='static'
IPADDR='192.9.201.21'
NETMASK='255.255.0.0'
MTU='1450'
DEVICE="eth2"

/etc/sysconfig/network-scripts/route-eth2

ADDRESS0=192.9.0.0
NETMASK0=255.255.0.0
GATEWAY0=192.9.201.200

ADDRESS1=10.10.1.0
NETMASK1=255.255.255.0
GATEWAY1=192.9.201.200

ADDRESS2=12.10.110.0
NETMASK2=255.255.255.0
GATEWAY2=192.9.201.200

Before the commit a71dcfd392cc1022c2 , routes corresponding to gateway 1 and gateway 2 can be added, but the route corresponding to gateway 0 fails to be added, and error message like :"RTNETLINK answers: File exists".

After the patch is merged, the route corresponding to gateway0 can replace the default route added by the kernel. As a result, the other two routes cannot be added, and the error message is displayed: Error: Nexthop has invalid gateway.

The patch aims to solve the race problem between routes and works successfully.But the failure to add gateway1 and gateway2 directly affects my network. In this case, users should not use the configuration like this? Or do we have a better solution?