cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:network:bonding.html



Linux:Netowrk

Bonding - How to Configure Network Bonding in Linux

Configuration in RHEL7/CentOS7

# modprobe --first-time bonding
# lsmod | grep bonding
bonding 129237 0


Configuration in RHEL6/CentOS6

Bonding Configuration

/etc/modprobe.d/bonding.conf

alias bond0 bonding


Interfaces Configurations

/etc/sysconfig/network-scripts/ifcfg-bond0

BONDING_OPTS is need.

DEVICE=bond0
BOOTPROTO=dhcp
ONBOOT=yes
BONDING_OPTS="mode=1 miimon=100"

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

DEVICE=eth0
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

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

DEVICE=eth1
MASTER=bond0
SLAVE=yes
BOOTPROTO=none


Configuration in RHEL5/CentOS5

Bonding Configuration

/etc/modprobe.conf

alias bond0 bonding
options bond0 miimon=100 mode=1


Interfaces Configurations

/etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
IPADDR=192.168.0.10
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=static

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

DEVICE=eth0
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

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

DEVICE=eth1
MASTER=bond0
SLAVE=yes
BOOTPROTO=none



Configuration in Ubuntu 16.04

# apt-get install ifenslave

/etc/modules

...
bonding
...


/etc/network/interfaces

...
auto eno49
iface eno49 inet manual
bond-master bond0

auto eno50
iface eno50 inet manual
bond-master bond0

auto bond0
iface bond0 inet manual
bond-slaves eno49 eno50
...






Bonding Module

/etc/modprobe.conf

formerly(/etc/modules.conf)

active-backup (mode=1)
alias bond0 bonding
options bond0 mode=1
options bond0 miimon=100 
alias bond0 bonding
options bond0 miimon=100 mode=1 primary=eth0
alias bond0 bonding
options bond0 mode=1 arp_interval=1000 arp_ip_target=192.168.10.1,192.168.10.2
round-robin (default mode)
alias bond0 bonding
options bond0 miimon=0 arp_interval=1000 arp_ip_target=192.168.0.1,192.168.0.2,192.168.0.3


bonding mode

value mode explanation switch
0 balance-rr
load balancing (round-robin)
Trunking
1 active-backup
fault-tolerance
Many system uses this mode. VLAN
2 Balance-XOR
load balancing (xor)
Trunking
3 Broadcast
fault-tolerance
VLAN
4 802.3ad
IEEE 802.3ad Dynamic link aggregation
IEEE 802.3ad
5 Balance-tlb
transmit load balancing
VLAN
6 Balance-alb
adaptive load balancing
VLAN


Check Configuration

/proc/net/bonding/bond0

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth4                    <- Active Interface : eth4
MII Status: up                                  <- up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up                                   <- up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 1c:c1:de:xx:xx:xx

Slave Interface: eth4
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:26:55:xx:xx:xx

SNMP MIB

# snmpwalk -v 1 -c public 192.168.1.101 interfaces
(abbr)
interfaces.ifTable.ifEntry.ifDescr.1 = lo
interfaces.ifTable.ifEntry.ifDescr.2 = bond1
interfaces.ifTable.ifEntry.ifDescr.3 = bond0
interfaces.ifTable.ifEntry.ifDescr.4 = eth0
interfaces.ifTable.ifEntry.ifDescr.5 = eth1
interfaces.ifTable.ifEntry.ifDescr.6 = eth2
interfaces.ifTable.ifEntry.ifDescr.7 = eth3
interfaces.ifTable.ifEntry.ifDescr.8 = eth4
interfaces.ifTable.ifEntry.ifDescr.9 = eth5
(abbr)

# snmpwalk -v 1 -c public 192.168.1.101 ip
(abbr)
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.101 = 3
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.2.1 = 4
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.3.1 = 6
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.4.101 = 2
(abbr)
#


Operation Note

Change Active ether

from eth1 to eth0

# cat /proc/net/bonding/bond0 |grep Currently
Currently Active Slave: eth1

# ifconfig eth1 down

# cat /proc/net/bonding/bond0 |grep Currently
Currently Active Slave: eth0

# ifconfig eth1 up
# cat /proc/net/bonding/bond0 |grep Currently

# cat /proc/net/bonding/bond0 |grep Currently
Currently Active Slave: eth0

load Bonding module

modprobe bonding
service network restart



os/linux/network/bonding.html.txt ยท Last modified: 2018/08/14 by admin

Page Tools