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 :
- Install the necessary kernel module
- Install necessary package
- Configure the virtual interface
- 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.
- Bring up the virtual NIC
- 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 :
to our virtual NIC :
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.