Red Hat Bugzilla – Bug 124042
Allow user to select the "default" route for an interface
Last modified: 2014-03-16 22:45:25 EDT
Suppose you have a separate network interface that you use to connect
to a corporate network. This corporate network has some structure to
it, such that it's not a single subnet. Yet there's no reason to have
your default route point to that company's router -- you still want to
reach the Internet over your regular internet connection. What you
want is to install a specific route for your corporate network's
address range, rather than a default route.
The attached patches allow you to specify a value for "DEFAULTROUTE"
in your ifcfg-ethN file, which will result in a route being added for
that subnet, rather than for "default". For instance, if you use eth0
to connect to your corporate network, which is 220.127.116.11/16, you can
add the following to ifcfg-ethN:
and as a result, you'll end up with a route to 18.104.22.168/16 pointing
out that interface.
Created attachment 100468 [details]
patch for /sbin/ifup
Created attachment 100469 [details]
patch for /sbin/dhclient-script
I forgot to mention that this change actually involves both /sbin/ifup
and /sbin/dhclient-script, which are two different packages. I just
chose one at random to file against, not being well-versed in how bug
reports are handled.
Why not just have static routes for that interface?
For DHCP, you don't know the gateway ahead of time, so you need the
DHCP agent to configure the proper route. And it seems proper to have
this feature accessible in the same manner regardless of whether
you're using DHCP or static configuration.
Well, I'd argue that the DHCP script needs to probably go away.
Closing; the best way to do this is with the static-routes file, and
if that interface isn't working with dhcp, that should be fixed.