Configuring network bonding (also known as NIC teaming or link aggregation) for servers enhances network performance, redundancy, and fault tolerance. Here’s a step-by-step guide to configure network bonding:
Prerequisites
- Network Interface Cards (NICs): Ensure your server has at least two physical NICs available for bonding.
- Switch Configuration: Configure the switch to support bonding/teaming (e.g., LACP for 802.3ad).
- Root or Admin Access: You must have administrative/root access to the server.
For Linux Servers
Linux uses bonding drivers to aggregate multiple NICs into a single virtual interface.
Step 1: Install Necessary Packages
Ensure the ifenslave
package is installed:
bash
sudo apt install ifenslave # On Debian/Ubuntu
sudo yum install iproute # On RHEL/CentOS
Step 2: Configure Bonding
Edit the network configuration files depending on your Linux distribution.
Debian/Ubuntu
- Edit the
/etc/network/interfaces
file:
“`bash
auto bond0
iface bond0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
bond-slaves eth0 eth1
bond-mode 802.3ad
bond-miimon 100
bond-xmit-hash-policy layer3+4
auto eth0
iface eth0 inet manual
auto eth1
iface eth1 inet manual
“`
- Restart networking:
bash
sudo systemctl restart networking
RHEL/CentOS
-
Create bonding configuration file
/etc/sysconfig/network-scripts/ifcfg-bond0
:
bash
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BONDING_OPTS="mode=4 miimon=100 xmit_hash_policy=layer3+4"
ONBOOT=yes -
Configure slave interfaces
/etc/sysconfig/network-scripts/ifcfg-eth0
:
bash
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
ONBOOT=yes -
Configure
/etc/sysconfig/network-scripts/ifcfg-eth1
:
bash
DEVICE=eth1
TYPE=Ethernet
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
ONBOOT=yes -
Restart the network service:
bash
sudo systemctl restart network
Bonding Modes in Linux
Choose a bonding mode based on your requirements:
– mode=0 (balance-rr): Round-robin policy for load balancing and fault tolerance.
– mode=1 (active-backup): One NIC active, others backup (fault tolerance only).
– mode=2 (balance-xor): XOR policy for load balancing.
– mode=3 (broadcast): Sends packets on all NICs (for special use cases).
– mode=4 (802.3ad): Dynamic link aggregation (requires LACP on the switch).
– mode=5 (balance-tlb): Adaptive transmit load balancing.
– mode=6 (balance-alb): Adaptive load balancing for transmit and receive.
For Windows Servers
Windows uses NIC Teaming for network bonding.
Step 1: Open NIC Teaming
- Open Server Manager.
- Go to Local Server.
- Under Properties, find NIC Teaming and click on it.
Step 2: Create a New Team
- In the NIC Teaming dialog box, click Tasks → New Team.
- Select the NICs you want to include in the team.
- Configure the team properties:
- Team Name: Specify the name of the team.
- Teaming Mode: Select:
- Switch Independent: No configuration required on the switch.
- LACP: Requires switch configuration for 802.3ad.
- Static Teaming: Requires manual configuration on the switch.
-
Load Balancing Mode: Choose between address hash or Hyper-V port.
-
Click OK.
Step 3: Assign IP Address
Assign an IP address to the new virtual NIC created by the team.
Testing and Verification
-
Linux: Check the bond status:
bash
cat /proc/net/bonding/bond0 -
Windows: Verify the NIC team by checking the network adapter status in Server Manager.
Important Notes
- Ensure NICs are connected to the same switch or switches that support bonding protocols.
- When using
mode=4 (802.3ad)
with Linux, enable LACP on the switch ports. - Test failover by disconnecting one NIC and verifying the server remains reachable.
Let me know if you need help with any specific step or troubleshooting!