High-Available Network

With high-available network, you can keep a connection with a server, even if a NIC/cable is down !
Nowadays, it's really important in enterprise network if we use SAN by instance.
How can we do this, is by using trunking/bonding technology. With this technology, you can bind two network card and it will become a virtual one available on the network.

With Debian Linux, it's very easy to use! It can be done in a few step :

  1. Install the necessary kernel module
  2. Install necessary package
  3. Configure the virtual interface
  4. Enjoy it !

Install the necessary kernel module

With a normal installation of a Debian, even with a minimally installed system, the module is already build, you only need to load it :

# modprobe bonding

Install necessary package

Now that you kernel is ready to use trunking, you need to install a software to set up properly your configuration :

# apt-get install ifenslave-2.6

Configure the virtual interface

It's time to configure your network to be an high-available one. What we want here is to have a virtual IP (I means an IP address not bind to a single NIC). We can do that with the software we previously installed.

  1. Bring up the virtual NIC
  2. Add the interfaces that will fail over the virtual NIC

The first step can be done with :

# ifconfig bond0 10.0.0.1 up

bond0 will be the name of our virtual NIC, and we will associated to it a virtual IP of 10.0.0.1
At this moment, no one can still ping this IP address [ 10.0.0.1 ] as we still didn't bind any physical NIC to this virtual IP address. So, this is our next step…
We will bind here two physical NIC :

  • eth1

and

  • eth2

to our virtual NIC :

  • bond0

This can be done with this command :

# ifenslave-2.6 bond0 eth1 eth3

Note that you can also get information about your virtual NIC with this command1 :

# cat /proc/net/bonding/bond0

You will get the mode2 your virtual NIC is running, and all the physical NIC bind to it.

Enjoy it !

And now, from a remote server, it's possible to ping the IP address [ 10.0.0.1 ] of the virtual NIC bond0.

dell-poweredge-debian4:~# ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.184 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.128 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.141 ms

You can also try to remove one cable from a physical NIC associated to the virtual NIC, and you will still be able to ping the virtual NIC.

External links

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License