3

I have two network interfaces eth0 and eth1 and I just wanna know how get the "eth1" as default route automatically if the "eth0" goes down?

1
  • 2
    Please define goes down. Does eth0 lose link or is does something upstream break? Are eth0, and eth1 connected to the same switch, or are they connected to different routers/networks.
    – Zoredache
    Jun 3, 2011 at 22:51

3 Answers 3

2

What you want is called interface bonding - There are lots of howtos on setting this up, this one is good for bare-bones "type this" information, and this one has a little more information.

The ifcfg-bonding manpage (& references) may also be of help, and is probably more up-to-date than any tutorials you'd find by googling..

2
  • I hadn't considered bonding as the answer here, maybe simply because of the phrasing of OPs question. This may be the right answer but its hard to tell.
    – dmourati
    Jun 3, 2011 at 21:45
  • @dmourati same way I didn't think of it being two NICs on different networks -- it's a bit vague :)
    – voretaq7
    Jun 3, 2011 at 21:51
1

You can use the metric argument to route. Metrics are counted as additional hops to the destination network or host.

route add default gw eth1defaultroute metric 10 dev eth1

This is the "old school" way of doing things.

You may also be interested to learn about iproute2:

ip route add default via eth1defaultroute metric 10 dev eth1

For more details, see:

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

http://www.policyrouting.org/iproute2.doc.html#ss9.5.1

1
  • ... If you're talking about two NICs on different subnets this is the way to go.
    – voretaq7
    Jun 3, 2011 at 21:50
0

Yet a third option is using BGP.

You must log in to answer this question.

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