Binding NIC cards in Ubuntu to create redundancy
If you have 2 network interfaces in Ubuntu, you may want to bind them together to create redundancy. If you bind two NICs together, 1 can be unplugged, or unavailable to the network and the IP address will still broadcast through the other NIC. So here’s how to do it in Ubuntu.
Add some settings into the /etc/modules file:
Note that “active-backup” means that the second NIC is not used unless the first becomes unavailable. You can change this if load balancing traffic to the machine is your goal.
Finally change the /etc/network/interfaces file:
iface bond0 inet static
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1
# The secondary network interface
iface bond0:0 inet static
Note that I used different IP addresses for each NIC. They both broadcast then, and the machine is available at X1 and X2 event though the NIC’s are bonded.
Restart your machine after you complete these changes. I’ve had very little success having the changes be applied correctly any other way. Once completed, you will be able to unplug either cable and still have your connection work. When unplugging, there will be a slight delay while the other card takes over the connections.