Tuesday, August 9, 2011

Network Bonding or Link Aggregation in Linux

Link aggregation or trunking or link bundling or Ethernet/network/NIC bonding or NIC teaming are computer networking umbrella terms to describe various methods of combining (aggregating) multiple network connections in parallel to increase throughput beyond what a single connection could sustain, and to provide redundancy in case one of the links fails.
 The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical bonded interface. The behavior of the bonded interfaces depends upon the mode; generally speaking, modes provide either hot standby or load balancing services. Additionally, link integrity monitoring may be performed.

Here I am showing you configuration for Centos, it will be same for others, may be some change in file location(depends on distro you are using).

[root@server199 ~]# cd /etc/sysconfig/network-scripts
[root@server199 network-scripts]#
[root@server199 network-scripts]# cat ifcfg-eth0
#Bonding eth0 to bond0
DEVICE=eth0
USERCTL=yes
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
TYPE=Ethernet
HWADDR=00:1c:c0:f8:3e:a9
[root@server199 network-scripts]# cat ifcfg-eth1
# Bonding eth1 to bond0
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
TYPE=Ethernet
PEERDNS=yes
IPV6INIT=no
HWADDR=00:06:29:af:c2:6c
[root@server199 network-scripts]#
 
Create a new file called ifcfg-bond0 and below line to it. I am showing contents of file.

[root@server199 network-scripts]# cat ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.2.199
NETMASK=255.255.255.0
TYPE=BOND
GATEWAY=192.168.2.1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes

Now do some changes in /etc/modprobe.conf file by addition of following two lines.


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

Next Restart network service

[root@server199 network-scripts]# service network reload
Shutting down interface bond0:                             [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Disabling IPv4 packet forwarding:  net.ipv4.ip_forward = 0
                                                           [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface bond0:                               [  OK  ]

[root@server199 network-scripts]# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:1C:C0:F8:3E:A9 
          inet addr:192.168.2.199  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:c0ff:fef8:3ea9/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:19257 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21223 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11049157 (10.5 MiB)  TX bytes:2416427 (2.3 MiB)

eth0      Link encap:Ethernet  HWaddr 00:1C:C0:F8:3E:A9 
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:14580 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10688 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:9979659 (9.5 MiB)  TX bytes:1232395 (1.1 MiB)
          Memory:d0a00000-d0a20000

eth1      Link encap:Ethernet  HWaddr 00:06:29:AF:C2:6C 
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:4677 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10535 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1069498 (1.0 MiB)  TX bytes:1184032 (1.1 MiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:19508 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19508 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6175688 (5.8 MiB)  TX bytes:6175688 (5.8 MiB)

Hope it will Help
!Feel free to comment

Kuldeep Sharma

Quickstart Guide for Kagent Setup with Local LM and Azure OpenAI

  LM Studio overview with running on the local system. To upgrade and install the kagent custom resource definitions (CRDs), you can execute...