[CentOS] Network and default route

Peter Farrow peter at farrows.org
Mon Apr 10 19:40:19 UTC 2006


Scott Silva wrote:
> I have had this problem on and off since RedHat 6, and I always worked through
> it, but I thought I would ask.
> When you have multiple network interfaces, how does the system determine the
> default route?
> Or is it the first, (or last) interface that comes up?
>
> On the problem systems I have to add a "route add default..." statement in
> some systems in the rc.local to get them to work right.
>
>
>   
You can add a default route into /etc/sysconfig/network, and the network 
with the matching network ip will take the route.

If you have more that one default route capability on different 
interfaces, you can set up routing tables for each of the networks , and 
then apply a weighting to each network default route in the main routing 
table...

There is an excellent discussion on it here, that answers your later 
question about sending out packets on the right interface.

http://lartc.org/howto/lartc.rpdb.multiple-links.html

If you follow the guidlines in this document but only add a default 
route to your main preferred gateway all traffic outgoing will be routed 
to that gateway but replies topackets on the other interfaces will still 
be serviced via the default routes on those interfaces if they come from 
networks outside the network ranges of all the network interfaces on the 
box....

If you want more detail, send me your ip ranges and ips and I will send 
you a set of ip rules/routes to achieve what you want...

Regards

Pete




More information about the CentOS mailing list