NIC Bonding in centos 6.x /rhel 6.x

This post is useful in case you have more then 1 NIC card but with poor speed e.g. 10 MBPS  and you require higher bandwidth transmission.

we can bind two or more NIC ( eth0,eth1,eth2........)   in one bonding interface to achieve a good bandwidth.

here is the steps to perform.

  1. Create bond0 config file:
  2. vi /etc/sysconfig/network-scripts/ifcfg-bond0
  3. Add the following lines:
  4. DEVICE=bond0
    
    IPADDR=192.168.1.20
    
    NETWORK=192.168.1.0
    
    NETMASK=255.255.255.0
    
    USERCTL=no
    
    BOOTPROTO=none
    
    ONBOOT=yes
    
    (Replace above IP address with your actual IP address. Save file and exit to shell, esc :wq)
  5. Edit eth0 config file:
  6. vi /etc/sysconfig/network-scripts/ifcfg-eth0
  7. Add the following lines:
  8. DEVICE=eth0
    
    USERCTL=no
    
    ONBOOT=yes
    
    MASTER=bond0
    
    SLAVE=yes
    
    BOOTPROTO=none
  9. Edit eth1 config file:
  10. vi /etc/sysconfig/network-scripts/ifcfg-eth1
  11. Add the following lines:
  12. DEVICE=eth1
    
    USERCTL=no
    
    ONBOOT=yes
    
    MASTER=bond0
    
    SLAVE=yes
    
    BOOTPROTO=none
  13. Load the modules on boot:
  14. vi /etc/modprobe.conf
  15. Add the following lines:
  16. alias bond0 bonding
    options bond0 mode=balance-alb miimon=100
     
     
    If you want to troubleshoot ( if having problem with bonding ) follow bellow steps-
    1. Load the modules, restart the network show the satus of the interface:
    2. modprobe bonding && service network restart && less /proc/net/bonding/bond0
    3. Output:
    4. Bonding Mode: load balancing (round-robin)
      MII Status: up
      MII Polling Interval (ms): 0
      Up Delay (ms): 0
      Down Delay (ms): 0
      
      Slave Interface: eth0
      MII Status: up
      Link Failure Count: 0
      Permanent HW addr: 00:0c:29:c6:be:59
      
      Slave Interface: eth1
      MII Status: up
      Link Failure Count: 0
      Permanent HW addr: 00:0c:29:c6:be:63
    5. list the interfaces seen by the system:
    6. ifconfig
    7. Output:
    8. bond0     Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
       inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
       inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
       UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
       RX packets:2804 errors:0 dropped:0 overruns:0 frame:0
       TX packets:1879 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:0
       RX bytes:250825 (244.9 KiB)  TX bytes:244683 (238.9 KiB)
      
      eth0      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
       inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
       inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
       UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
       RX packets:2809 errors:0 dropped:0 overruns:0 frame:0
       TX packets:1390 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000
       RX bytes:251161 (245.2 KiB)  TX bytes:180289 (176.0 KiB)
       Interrupt:11 Base address:0x1400
      
      eth1      Link encap:Ethernet  HWaddr 00:0C:29:C6:BE:59
       inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
       inet6 addr: fe80::20c:29ff:fec6:be59/64 Scope:Link
       UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
       RX packets:4 errors:0 dropped:0 overruns:0 frame:0
       TX packets:502 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000
       RX bytes:258 (258.0 b)  TX bytes:66516 (64.9 KiB)
       Interrupt:10 Base address:0x1480
     
 

Comments

Popular posts from this blog

using libguestfs virt-customize tool to modify qcow2 image and reset root password.

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

setting up openshift alert manager mail alerting based on critical and warning