How do I configure network bonding for servers?

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

  1. Network Interface Cards (NICs): Ensure your server has at least two physical NICs available for bonding.
  2. Switch Configuration: Configure the switch to support bonding/teaming (e.g., LACP for 802.3ad).
  3. 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
  1. 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
“`

  1. Restart networking:
    bash
    sudo systemctl restart networking
RHEL/CentOS
  1. 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

  2. Configure slave interfaces /etc/sysconfig/network-scripts/ifcfg-eth0:
    bash
    DEVICE=eth0
    TYPE=Ethernet
    BOOTPROTO=none
    MASTER=bond0
    SLAVE=yes
    ONBOOT=yes

  3. Configure /etc/sysconfig/network-scripts/ifcfg-eth1:
    bash
    DEVICE=eth1
    TYPE=Ethernet
    BOOTPROTO=none
    MASTER=bond0
    SLAVE=yes
    ONBOOT=yes

  4. 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

  1. Open Server Manager.
  2. Go to Local Server.
  3. Under Properties, find NIC Teaming and click on it.

Step 2: Create a New Team

  1. In the NIC Teaming dialog box, click Tasks → New Team.
  2. Select the NICs you want to include in the team.
  3. Configure the team properties:
  4. Team Name: Specify the name of the team.
  5. 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.
  6. Load Balancing Mode: Choose between address hash or Hyper-V port.

  7. Click OK.

Step 3: Assign IP Address

Assign an IP address to the new virtual NIC created by the team.


Testing and Verification

  1. Linux: Check the bond status:
    bash
    cat /proc/net/bonding/bond0

  2. 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!

How do I configure network bonding for servers?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top