You can get the advice from IT HELP DESK

SYSTEM[LINUX] Bonding Setup Guide

Robert
18 Jan 2019
<head>Disk Management, Server Monitoring, System management, server monitoring, server management, system management, system monitoring, </head>

[LINUX] Bonding Setup Guide



Hello ~ !

Today we'll look at the Bonding setting .


Bonding that bundles multiple network interface cards into one interface!

Now let's look at Bonding-related settings and issues!


1. What is Bonding?


Bonding is a technology built into Linux itself that combines two or more network interface cards into one logical interface 

It is a technology that responds to physical failures of the NIC or increases throughput.


Easily explained if this technique to create multiple NIC as a single NIC Bonding right is.



What are the advantages of Bonding?


  • In theory, multiple NICs are written as one NIC, so you can run as much bandwidth as each NIC's bandwidth.
  • If multiple NICs are configured as one NIC, even if one of the bonded NICs fails, the other NICs will operate normally, so network connectivity is possible.



2. Bonding settings 

  2.1 vi /etc/sysconfig/network

Setting
Description

NETWORKING=yes
HOSTNAME=logcenter
GATEDEV=bond0



More details


  2.2 vi /erc/modprobe.conf

Setting
Description

alias bond0 bonding
alias eth0 tg3
alias eth1 tg3
alias scsi_hostadapter ata_piix
alias usb-controller ehci-hcd
alias usb-controller1 uhci-hcd
options bonding mode=1
options bond0 miimon=100



The latest addition to the top of the file




specified bonding beongsik: 1 = active-standby mode
NIC Health check time (1/100 sec)



  2.3 Bonding Mode (Reference)

Mode
Description
0
balance-round robine (distribution via two NICs + Fault Tolerance)
1
active-standby (Fault Tolerance in case of a problem in active NIC)
2
balance-xor (similar to 0, but using the xor operation on the destination Mac and the source Mac) + Fault tolerance
3
broadcast (data communication with no rules on two NIC + Fault Tolerance)
4
802.3ad (link aggregation) - need to create aggregation group on switch



  2.4 vi /etc/sysconfig/network-scripts/ifcfg-bond0 (Create additional files)

Setting
Description

DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
IPADDR=192.168.1.199
NETMASK=255.255.255.0
NETWORK=192.168.1.0
GATEWAY=192.168.1.1



ex) In the case of multiple bonding such as bond0, bond1, etc. Default GATEWAY is displayed only in bond0.

IP Address to be used
NETMASK
GATEWAY
Default GATEWAY



  2.5 vi /etc/sysconfig/network-scripts/ifcfg-eth0

Setting
Description

DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
ETHTOOL_OPTS="speed 100 duplex full autoneg off"









Fix transmission speed (optional)



  2.6 vi /etc/sysconfig/network-scripts/ifcfg-eth1

Setting
Description

DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
ETHTOOL_OPTS="speed 100 duplex full autoneg off"








Fix transmission speed (optional)


  2.7 modprobe bonding


  2.8 lsmod | grep bonding (check if the module is up)


  2.9 Restart network services


  2.10 Checking with ifconfig Command


[root@logcenter /]# ifconfig

Bonding IP and MAC

bond0     Link encap:Ethernet  HWaddr 90:E6:BA:92:2E:F2

          inet addr:192.168.1.199  Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::92e6:baff:fe92:2ef2/64 Scope:Link

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

          RX packets:31005 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2699 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:3763204 (3.5 MiB)  TX bytes:665391 (649.7 KiB)


eth0      Link encap:Ethernet  HWaddr 90:E6:BA:92:2E:F2

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:18010 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2699 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:2813627 (2.6 MiB)  TX bytes:665391 (649.7 KiB)

          Interrupt:169

Real NIC must be SLAVE











eth1      Link encap:Ethernet  HWaddr 90:E6:BA:92:2E:F2

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:12995 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:949577 (927.3 KiB)  TX bytes:0 (0.0 b)

           Interrupt:177
Real NIC must be SLAVE












  2.11 cat /proc/net/bonding/bond0

Status
Description

Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)

Bonding version

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Bonding Mode Switching between


Active NIC
Link Status
Fail





Slave Interface: eth0

MII Status: up

Link Failure Count: 0

Permanent HW addr: 90:e6:ba:92:2e:f2

Link Status
Number of Link Fail since OS Startup

Slave Interface: eth1

MII Status: up

Link Failure Count: 0

Permanent HW addr: 90:e6:ba:92:2e:62

Link Status
Number of Link Fail since OS Startup



  2.12 route (Confirm default GATEWAY)



3. Bonding Issues

3.1 Output MAC Address conflict message after setting Bonding

Status
Description

Kernel:bonding: bond0:0 - Warning: the permanent HWaddr of eth0 – xx : xx : xx : xx : xx : xx – is still in use by

Bond0. Set the HWaddr of eth1 to a different address to 

 Avoid conflicts

Mac address conflict warning message for bond0 and eth0 when re-running network service after bonding



  3.2 Causes

If you set bond0 using eth0 and eth1, the above warning may occur.

This is because bond0 is using the MAC address of eth0, so when the bond0 module stops the network service, 

SLAVE device is stopped in order of eth0, eth1, and the MAC address-owned device used by bond0 stops before the other device.



  3.3 Solution

1) MAC address used by bond0 Set this device to other than eht0

Status
Description
add MACADDR to eth0 at the end of ifcig-bond0
ex) MACADDR = aa: aa: aa: aa: aa: aa
Set MAC address device of Bond0 to other than eth0


2) Edit ifdown-eth to change the order of stopping devices from eth1 to eth0



So far, we've learned about Bonding settings and issues!