Configuring Port Bonding in Linux
This section uses RHEL 7.2 as an example. For details about the configuration on other OSs, see the OS documentation provided by the OS vendors.
In RHEL 7.2, use the OS configuration file to configure port bonding for the MZ520. The MZ520 supports seven port bonding modes, which are classified into three types: active-backup, balancing, and 802.3ad.
Bonding members can be physical 10GE ports (NPAR is disabled) or NIC PFs (UMC is enabled) on the MZ520. PFs derived from the same physical port cannot be configured as a bond. When NPAR is enabled, the bonding mode can be only active-backup or balancing. Only physical ports or NIC PFs across chips can be bonded in active-backup and balancing modes, and only physical ports of the same chip can be bonded in 802.3ad mode.
To configure port bonding for the MZ520, perform the following steps:
- Run the ifconfig -a command to locate the MZ520 ports.
- Go to /etc/sysconfig/network-scripts, and create the file ifcfg-bond0 in this directory.
[root@localhost ~]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# vi ifcfg-bond0
- Add the following information to the ifcfg-bond0 file:
BOOTPROTO='static' BROADCAST='192.168.100.255' //Enter the broadcast address on this network segment. IPADDR='192.168.100.100'//Enter an IP address for the port bonding. NETMASK='255.255.255.0' //Enter a subnet mask. NETWORK='192.168.100.0' //Enter an IP address segment. STARTMODE='onboot' BONDING_MASTER='yes' BONDING_MODULE_OPTS='miimon=100' BONDING_SLAVE0='enp4s0f0'//Enter the actual port number. BONDING_SLAVE1='enp4s0f1'//Enter the actual port number.
- Move the ifcfg-enp4s0f[num] files to the backup directory.
#mv /etc/sysconfig/network-scripts/ifcfg-enp4s0f0 /backup/ifcfg-enp4s0f0 #mv /etc/sysconfig/network-scripts/ifcfg-enp4s0f1 /backup/ifcfg-enp4s0f1
- Go to /etc, and add the following information to the end of the modprobe.conf.local file:
#vi /etc/modprobe.conf.local alias bond0 bonding options bonding miimon=100 mode=0 use_carrier=0
In the information, mode indicates the bonding mode. The MZ520 supports seven bonding modes:
0: balance-rr (round-robin)
1: active-backup
2: balance-xor
3: broadcast
4: 802.3ad
5: balance-tlb
6: balance-alb
If you want to set the bonding mode to 802.3ad, set the peer device port connected to the MZ520 to the link aggregation mode (static) based on the IEEE 802.3ad specifications. For other bonding modes, the peer device port does not need special configuration.
- Run the following command to restart the network application:
#/etc/init.d/network restart
or
#service network restart