P r o f e s s i o n a l — M a n a g e m e n t — S o l u t i o n s
RSS icon Email icon Home icon
  • Binding multiple network interfaces (NIC) into single interface

    Posted on July 1st, 2010 Admin No comments

    Today we had successfully binded two nic cards into one single interface , Basically the purpose is to increase the speed and bandwidth as Linux allows administrators to bind NICs together into a single channel using the bonding kernel module and a special network interface called a channel bonding interface. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy. Before proceeding make sure both the interfaces eth0 and eth1 are having a uplink. You can check using mii-tool command.

    eth0: negotiated 100baseTx-FD, link ok
    eth1: negotiated 100baseTx-FD, link ok

    To channel bond multiple network interfaces, the system administrator must perform the following steps:

    Setting up bounding is easy CentOS release 5.5 (Final)

    Step #1: Create a bond0 configuration file

    CentOS linux stores network configuration in /etc/sysconfig/network-scripts/ directory. So you need to create bond0 config file:

    # nano /etc/sysconfig/network-scripts/ifcfg-bond0

    Append following lines to it:-

    DEVICE=bond0
    IPADDR=12.12.12.12
    NETMASK=255.255.255.0
    NETWORK=12.12.12.0
    BROADCAST=12.12.12.255
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    BONDING_SLAVE0=”eth0″
    BONDING_SLAVE1=”eth1″

    Make sure you Replace the above IP address with your actual IP address.  Save file and exit to shell prompt.

    Step #2: Modify eth0 and eth1 config files:

    Open both configuration using nano or vi text editor and make sure file read as follows for eth0 interface

    # nano /etc/sysconfig/network-scripts/ifcfg-eth0

    Modify/append directive as follows:

    DEVICE=eth0
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    MASTER=bond0
    SLAVE=yes

    Open eth1 configuration file using nano or vi text editor:

    # nano /etc/sysconfig/network-scripts/ifcfg-eth1

    Make sure file read as follows for eth1 interface:

    DEVICE=eth1
    ONBOOT=yes
    BOOTPROTO=none
    USERCTL=no
    MASTER=bond0
    SLAVE=yes

    Save file and exit to shell prompt.

    Step # 3: Load bond driver/module

    Make sure bonding module is loaded when the channel-bonding interface (bond0) is brought up. You need to modify kernel modules configuration file:

    # nano /etc/modprobe.conf

    Append following two lines:

    alias bond0 bonding
    options bond0 mode=balance-rr miimon=100

    Save file and exit to shell prompt.

    Here we are using Round-robin policy which Transmit packets in sequential order from the first available slave through the last.  This mode provides load balancing and fault
    tolerance. You need to decide which method you want to use for interface — For More information please check network_card_bonding_centos

    Step # 4: Test configuration

    Instead of probing the module or doing a network service restart you may hang out from the server so the best way will be to reboot the server.

    Verify everything is working by cat /proc/net/bonding/bond0

    Output:-

    Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

    Bonding Mode: load balancing (round-robin)
    MII Status: up
    MII Polling Interval (ms): 100
    Up Delay (ms): 0
    Down Delay (ms): 0

    Slave Interface: eth0
    MII Status: up
    Link Failure Count: 1
    Permanent HW addr: 00:04:21:d6:fw:db

    Slave Interface: eth1
    MII Status: up
    Link Failure Count: 0
    Permanent HW addr: 00:07:e3:0f:6c:f7

    List all interfaces using ifconfig command and you should notice that the same Mac address is assigned to all the three interfaces. You can also the RX TX bytes values so That should tell you its working good.

    Share/Save/Bookmark

    Leave a reply

    You must be logged in to post a comment.