I've overridden the ip routing rules on my RHEL machine by adding custom logic in a new script ifup-local that is run immediately after a new interface is attached.

/etc/sysconfig/network-scripts/ifup-eth executes dhclient with lease times for each interface. At the end of a lease period dhclient tries to update the ip rules which conflict with my settings.

Is there a way I can avoid this? As a work-around I've also written a script that runs at the same time as dhclient and removes the new rules written by dhclient.

1 Answer 1


You can use dhclient-script and its hooks to override the route configuration.

For example, add this line to /etc/dhcp/dhclient-enter-hooks.d/no-default-route:

unset new_routers

So the default gateway does not get set. You can add any logic you want in this script.

  • I don't have any such file on my RHEL machine. Isn't this true for Debian or Ubuntu? Sep 15, 2014 at 16:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .