Difference between revisions of "CentOS 7.x network bonding"

From Notes_Wiki
m
m
Line 3: Line 3:


It is possible to combine to NICs in a single bond interface for redundancy, performance, etc. reasons.  To configure bond on top of two physical interfaces use following steps:
It is possible to combine to NICs in a single bond interface for redundancy, performance, etc. reasons.  To configure bond on top of two physical interfaces use following steps:
# Identify two identical interfaces for creating bond.  These interfaces should have same speed and should be connected to same VLAN(s).
# Identify two identical interfaces for creating bond.  These interfaces should have same speed and should be connected to same VLAN(s). Use following to check interface speed and connectivity:
#:<pre>
#:: ifconfig -a
#:: ethtool &lt;interface-name&gt;
#:</pre>
#:: Eg '<tt>ethtool ens0</tt>'
# Go to /etc/sysconfig/network-scripts/ folder
# Go to /etc/sysconfig/network-scripts/ folder
# Create '<tt>ifcfg-bond0</tt>' with contents similar to:
# Create '<tt>ifcfg-bond0</tt>' with contents similar to including all IP addressing configuration:
#:<pre>
#:<pre>
#::DEVICE=bond0
#::DEVICE=bond0
Line 15: Line 20:
#::NETMASK=255.255.255.0
#::NETMASK=255.255.255.0
#::GATEWAY=192.168.122.1
#::GATEWAY=192.168.122.1
#::DNS1=192.168.122.1
#::BONDING_MASTER=yes
#::BONDING_MASTER=yes
#::BONDING_OPTS="miimon=0 updelay=0 downdelay=0 mode=4"
#::BONDING_OPTS="miimon=0 updelay=0 downdelay=0 mode=4"
#:</pre>
#:</pre>
#:where mode=4 refers to 802.3ad or LACP.  For other types of mode such as balance-rr, active-backup, balance-xor, etc. refer to reference links at the end  
#:where '''mode=4 refers to 802.3ad or LACP'''.  For other types of mode such as balance-rr, active-backup, balance-xor, etc. refer to reference links at the end  
#:In case of less information on network switch end or while using unmanageable switches, use mode=5 as that seems to be able to detect interfaces going up or down properly.
#:In case of less information on network switch end or '''while using unmanageable switches, use mode=5''' as that seems to be able to detect interfaces going up or down properly.
#:If there are additional IP addressing lines then they should also be part of ifcfg-bond0 and not part of individual interface configuration files:
#::<pre>
#:::DEFROUTE="yes"
#:::PEERDNS="yes"
#:::PEERROUTES="yes"
#:::IPV4_FAILURE_FATAL="no"
#:::IPV6INIT="no"
#:::IPV6_AUTOCONF="no"
#:::IPV6_DEFROUTE="no"
#:::IPV6_PEERDNS="no"
#:::IPV6_PEERROUTES="no"
#:::IPV6_FAILURE_FATAL="no"
#::</pre>
# Update interface configuration files to depend on bond using:
# Update interface configuration files to depend on bond using:
#:<pre>
#:<pre>
Line 31: Line 50:
#:</pre>
#:</pre>
#::where ens0 is the name of one of the two ethernet interfaces to be added to bond
#::where ens0 is the name of one of the two ethernet interfaces to be added to bond
# Do the same for second ethernet interface
#::If you are copying interface files from one machine to another ensure that HWADDR and UUID paramemters (both optional) are not copied as they can be unique to a particular system.
# Do the same for second Ethernet interface
# Restart network for settings to take effect:
# Restart network for settings to take effect:
#:<pre>
#:<pre>

Revision as of 01:28, 29 May 2019

<yambe:breadcrumb>CentOS_7.x_network_management|CentOS 7.x network management</yambe:breadcrumb>

CentOS 7.x network bonding

It is possible to combine to NICs in a single bond interface for redundancy, performance, etc. reasons. To configure bond on top of two physical interfaces use following steps:

  1. Identify two identical interfaces for creating bond. These interfaces should have same speed and should be connected to same VLAN(s). Use following to check interface speed and connectivity:
    ifconfig -a
    ethtool <interface-name>
    Eg 'ethtool ens0'
  2. Go to /etc/sysconfig/network-scripts/ folder
  3. Create 'ifcfg-bond0' with contents similar to including all IP addressing configuration:
    DEVICE=bond0
    NAME=bond0
    TYPE=Bond
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=192.168.122.150
    NETMASK=255.255.255.0
    GATEWAY=192.168.122.1
    DNS1=192.168.122.1
    BONDING_MASTER=yes
    BONDING_OPTS="miimon=0 updelay=0 downdelay=0 mode=4"
    where mode=4 refers to 802.3ad or LACP. For other types of mode such as balance-rr, active-backup, balance-xor, etc. refer to reference links at the end
    In case of less information on network switch end or while using unmanageable switches, use mode=5 as that seems to be able to detect interfaces going up or down properly.
    If there are additional IP addressing lines then they should also be part of ifcfg-bond0 and not part of individual interface configuration files:
    DEFROUTE="yes"
    PEERDNS="yes"
    PEERROUTES="yes"
    IPV4_FAILURE_FATAL="no"
    IPV6INIT="no"
    IPV6_AUTOCONF="no"
    IPV6_DEFROUTE="no"
    IPV6_PEERDNS="no"
    IPV6_PEERROUTES="no"
    IPV6_FAILURE_FATAL="no"
  4. Update interface configuration files to depend on bond using:
    DEVICE=ens0
    ONBOOT=yes
    TYPE=Ethernet
    BOOTPROTO=none
    MASTER=bond0
    SLAVE=yes
    NM_CONTROLLED="no"
    where ens0 is the name of one of the two ethernet interfaces to be added to bond
    If you are copying interface files from one machine to another ensure that HWADDR and UUID paramemters (both optional) are not copied as they can be unique to a particular system.
  5. Do the same for second Ethernet interface
  6. Restart network for settings to take effect:
    systemctl restart network
  7. Use following to make sure bond is formed properly:
    cat /proc/net/bonding/bond0


Refer:


Troubleshooting steps

  • If in cat /proc/net/bonding/bond0 output only one interface is shown and other is not showing up then validate SLAVE=yes and MASTER=bond0 are present in the interface configuration file for the other interface.
  • If bond0 itself is not getting created make sure DEVICE=bond0, NAME=bond0 etc. is present in ifcfg-bond0 file


<yambe:breadcrumb>CentOS_7.x_network_management|CentOS 7.x network management</yambe:breadcrumb>