Configuring NIC Teaming in Linux


Link Bonding/NIC Teaming – In some scenarios, to increase the bandwidth we may need to bundle two or more physical interfaces to a single virtual bonding interface on the host. Below steps show how to configure link bonding (also called as port-channel) on a Linux host.

  • Create “ifcfg-bond0” file in /etc/sysconfig/network-scripts and configure IP address, network mask and other port-channel parameters.
[root@server2 network-scripts]# vi ifcfg-bond0
[root@server2 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.10.1
NETWORK=192.168.10.0
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
  • Configure individual interface such that “MASTER” is set to “bond0” and “SLAVE” is set.
[root@server2 network-scripts]# vim /etc/sysconfig/network-scripts/ifcfg-eth4
[root@server2 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth4
# Intel Corporation 82571EB Gigabit Ethernet Controller (Copper)
DEVICE=eth4
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
[root@server2 network-scripts]#
  • Make sure bonding module is loaded. If not add below two lines in /etc/modprobe.conf file. ”mode” determines bonding policy. By default it is “balance-rr” (round robin). For LACP configure mode as “802.3ad”. For active-backup configure mode as “active-backup”
[root@server2 network-scripts]# cat /etc/modprobe.conf | grep bond0
alias bond0 bonding
options bond0 miimon=100 mode=802.3ad
[root@server2 network-scripts]#
  • Load the bonding module using “modprobe bonding” command if it is not already loaded. Restart the network service using “service network restart”. Check with “ifconfig bond0” or “cat /proc/net/bonding/bond0” command.
[root@server2 network-scripts]# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr 00:18:FE:2E:36:6D
          inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::218:feff:fe2e:366d/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:89 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2572 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:10920 (10.6 KiB)  TX bytes:315684 (308.2 KiB)
[root@server2 network-scripts]#

<on the other end- Force10 switch>

Force10#show int po brief

Codes: L – LACP Port-channel

LAG  Mode  Status       Uptime      Ports

L   1    L3    up           00:19:22    Gi 4/4     (Up)

Gi 4/5     (Up)

Force10#

<With active-backup mode. eth4/eth5 are bundled together. eth5 is primary active>

 [root@server2 ~]# cat /etc/modprobe.conf | grep bond
alias bond0 bonding
options bond0 miimon=100 mode=1 primary=eth5
[root@server2 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.1.1 (September 26, 2006)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth5
Currently Active Slave: eth5
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth4
MII Status: up
Link Failure Count: 2
Permanent HW addr: 00:18:fe:2e:36:6d
Slave Interface: eth5
MII Status: up
Link Failure Count: 8
Permanent HW addr: 00:18:fe:2e:36:68
——–

modprobe <module-name>   : to add this module

lsmod : to list loaded module

rmmod <module-name> : to remove a module

“cat /etc/modprobe.conf” : to view the module

——–

 

Advertisements
This entry was posted in Linux and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s