Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

Details:

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Firstly, I don't think you can meaningfully set a default gateway on an interface-by-interface basis.

If what you're saying is that you want your default gateway to come from your static entry, rather than from dhcp, you need to tell the DHCP subsystem not to acquire one.

If memory serves, C62 uses dhclient, which unhelpfully doesn't have a simple run-time flag that says "don't set default route". Instead, man dhclient.conf suggests that you have to list the options that you do want dhclient to set, so in /etc/dhcp/dhclient-eth0.conf you'll want something like

request subnet-mask, broadcast-address, domain-name, domain-search, domain-name-servers;

Note the absence of routers. This should leave your manually-set gateway of 10.76.220.205 as your system's operating default gateway.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.