Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

In my Linux server i have three network cards. The eth0 card is connected to ISP1, the eth1 card is connected to LAN and the eth3 card is connected to ISP2.

What i want to do is to automatically use eth3 as Internet connection if the eth0 connection fails. How can this be done?

Another problem is that my firewall is referring to eth0 as the server is doing NAT for clients this would be broken if eth3 is taken in use, how can this be solved?

share|improve this question

Here's a link you might find helpful if your network is simple enough: Fallback gateways. For more complicated situations, you'll need solutions like Quagga, an implementation of OSPF protocol for Linux.

share|improve this answer

To achieve fail-over networking in Linux you need to bond the two NICs in Active Backup (or High-Availability) mode. Refer to Linux bonding driver documentation for more details, if needed.

Basically, to form the bonding with 2.6 kernel you need to

  • install package ifenslave-2.6: (apt-get install ifenslave-2.6)
  • edit /etc/network/interfaces to form the bonding (replace values as needed):
iface bond0 inet static
up /sbin/ifenslave bond0 eth0
up /sbin/ifenslave bond0 eth3
  • add the following lines to your /etc/modprobe.d/arch/i386 to select the correct mode:
alias bond0 bonding

options bonding mode=active-backup miimon=100 downdelay=200 updelay=200

You should also make sure that the NICs' kernel modules are loaded automatically.

Concerning the firewall rules, as I don't know what kind of rules you have, maybe using bond0 instead of eth0 is enough?

share|improve this answer
Bonding across two different ISPs won't work - they will almost certainly have different IP addresses. And you'd want to monitor more than just link state to determine if the internet connection is up/down. – James Apr 20 '10 at 11:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.