Configuring Linux Bonding: bond0 using eth0 eth1 and wlan0
This is a simple howto tutorial for creating and bonding three interfaces, a wireless one (wlan0), one RealTek based GIGe cabled NIC (eth0) and another alternate Intel based GIGe NIC (eth1). This is partially a conceptual howto since a home HTPC / Backup center probably doesn't need three separate NIC's for redundancy. However, with recent ventures into the world of GIGe ethernet and associated issues, it does add some merit to this initiative. The wireless NIC card (wlan0) is thrown here just to add another level of redundancy: a wireless one.
Here are the steps to configuring bonding on RHEL / SL Linux:
Step | Step Name | Command / Results |
1 | Plug in your network cards that will be participating in the bonding. |
The results should look similar to this from the OS side:
|
2 | Once plugged in, find the MAC address of each card. | To get the MAC address, provided you have not yet configured bonding, by simply issuing ifconfig -a or netstat -ie. Please see here for alternate ways of finding the MAC. |
3 | Define your interfaces. |
To do so, we'll need to create a number of files under /etc/sysconfig/network-scripts:
The items in blue, green and bolded black being key here. Notice, we only specify an IP for the bond0 interface, not the slaves. |
4 | Ensure the bonding module will load on startup. |
Ensure the following line exists in the /etc/rc.local file:
# cat /etc/rc.local|grep bonding In addition, ensure the /etc/modprobe.d/modprobe.conf file is defined to load the bonding module including any customizations:
# cat /etc/modprobe.d/modprobe.conf The bonding mode selected is 2 for active-backup configuration since we only want to use wlan0 for backup. (In case all connection with the server fails through eth0 and eth1)
(Optional)
install bond0 /sbin/modprobe –ignore-install -o bonding0 bonding miimon=100 |
5 |
(Optional) It is recommended |
To do this, it is recommended to define some UDEV rules
This will ensure that the network card names per each ethernet adapter (as listed in lspci above) will always retain the same name. |
6 | Load the bonding module. |
Check first that it isn't loaded, if it is, skip to the next step:
# lsmod|grep bonding If it isn't loaded, load it using: # modprobe bonding
|
7 | Restart the network. |
Issue the following to restart your network: # service network restart to make the changes take effect. |
And this completes our bonding tutorial. Feel free to leave a reply on your bonding success story. We'd love to hear from you.
Cheers,
TK
[…] Linux Bonding […]