Network Interface Card (NIC) bonding, also known as network bonding, is a technique used in Linux to combine multiple network interfaces into a single interface. This not only provides redundancy, but also load balancing and failover capabilities, resulting in higher network efficiency and resilience. In this blog post, we will guide you through the process of setting up NIC bonding on a Linux system.
Prerequisites
Before starting, ensure that you have at least two network interface cards and root or super user access to your Linux system.
Step 1: Install the IFENSALVE package
The first step is to install the ifenslave package. The ifenslave is a Linux tool that allows a network administrator to bind multiple network interfaces into a single channel. Install it using the following command:
1 | # apt-get install ifenslave |
Step 2: Load the Bonding Kernel Module
The next step is to load the bonding module into the Linux kernel. Use the modprobe command to do this:
1 | # modprobe bonding |
Step 3: Configure Bonding
All the network-related configurations in Linux are stored in the /etc/network/interfaces file. To configure bonding, open this file:
1 | # nano /etc/network/interfaces |
After opening the file, append the following lines to create a bond and add your network interfaces to it:
1 2 3 4 5 6 7 8 | auto bond0 iface bond0 inet static address 192.168.1.10 gateway 192.168.1.1 netmask 255.255.255.0 bond-slaves eth0 eth1 bond-mode balance-rr bond-miimon 100 |
Step 4: Restart Networking Services
Finally, after all the configuration is done, save your changes and restart the networking service for the changes to take effect:
1 | # /etc/init.d/networking restart |
Conclusion
And that’s it! You have successfully configured NIC bonding on your Linux system. Now, your system will use multiple interfaces as if they were a single interface, providing increased bandwidth and redundancy. Happy networking!