Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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 '11 at 22:51

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..

share|improve this answer
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 '11 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 '11 at 21:51

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:

share|improve this answer
... If you're talking about two NICs on different subnets this is the way to go. – voretaq7 Jun 3 '11 at 21:50

Yet a third option is using BGP.

share|improve this answer

Your Answer


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.