Desired result: Assign an interface-specific gateway in the circumstance that are also receiving general DHCP-supplied gateway settings.
Current situation: Interface-specific gateway setting is not recognized, probably because it by default has the same metric as the DHCP-supplied gateway. Changing the metric of the interface-specific gateway allows it to be recognized, but then results in the undesired situation of not having the interface-specific gateway with a superior metric. Barring changing the DHCP-supplied settings, is there anything I can do?
I'm trying to add an interface-specific gateway, so I've added the line:
default via 10.76.220.205 dev eth1
to route-eth0 but when I restart networking, I receive the following error:
RTNETLINK answers: File exists
According to the RHEL Deployment Guide:
If the default gateway is already assigned from DHCP, the IP command arguments format can cause one of two errors during start-up, or when bringing up an interface from the down state using the ifup command: "RTNETLINK answers: File exists" or 'Error: either "to" is a duplicate, or "X.X.X.X" is a garbage.', where X.X.X.X is the gateway, or a different IP address. These errors can also occur if you have another route to another network using the default gateway. Both of these errors are safe to ignore.
The host is currently assigned to DHCP, but I would like to override the gateway setting for a particular interface. When I run 'route' my new route does not appear listed, even though I added the above line to the route-eth0 file and I've restarted networking. When I add a metric to the route-eth0 file, such as:
default via 10.76.220.205 dev eth1 metric 1
The 'route' command does show my additional gateway. It seems that networking only recognizes a second gateway only if it has a different metric. (The default gateway metric from the dhcp-provided gateway is 0). But this leaves me with of course my new interface-specific gateway having a metric higher than the DHCP-supplied gateway and therefore remaining unused. Any suggestions on how to resolve this problem?