Technical Tip

QUESTION

How can I set up network bonding and teaming with the Network Manager nmcli command in RedHat/CentOS/Oracle Linux 7?

ANSWER
Bonding with nmcli:-

Bonding interfaces can be configured with nmcli.
For example:-
# nmcli  conn  add  type bond  con-name  bond0  ifname  bond0
# nmcli  con  mod  bond0  ipv4.addresses  192.168.200.202
# nmcli  con  mod  bond0  ipv4.method  manual
The above command switches off DHCP.

Now we add the slave devices eth1 and eth2 (These physical interfaces may have
more complex names such as enp0s8, enp0s9, etc.):-
# nmcli  con  add  type  bond-slave  con-name  bond0-eth1  ifname  eth1  master  bond0
# nmcli  con  add  type  bond-slave  con-name  bond0-eth2  ifname  eth2  master  bond0

Now we can examine the bond0 connection:-
# nmcli  con  show | grep  bond
bond0-eth2   a7580c59-ef0b-44fb-8677-c79e52f74d79  802-3-ethernet  eth2      
bond0-eth1   95563f4a-50cc-4131-a808-717cf9154c3e  802-3-ethernet  eth1      
bond0        e49ce7b7-42b0-431b-87d3-e88f50d40315  bond            bond0     

Now bring up the bond0 interface:-
# nmcli  con  up  bond0
# ip  addr  show  bond0
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
    link/ether 08:00:27:89:9f:d8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.202/32 brd 192.168.200.202 scope global bond0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe89:9fd8/64 scope link tentative dadfailed
       valid_lft forever preferred_lft forever

Teaming with nmcli:-

An alternative to bonding; apparently teaming will eventually supersede bonding.
One of the main differences is that teaming uses the teamd daemon, as well as a kernel module, and comes with the teamdctl and teamnl utilities.
Configuration is very similar to bonding:-
# nmcli  con  add  type  team  con-name  team0  ifname  team0  config  '{"runner":{"name" : "loadbalance",  "hwaddr_policy" : "by_active" }}'
Above creates the team0 connection, i.e. The master teaming interface.

# nmcli  con  mod  team0  ipv4.method  manual
Switch off DHCP.

# nmcli  con  mod  team0  ipv4.addresses  192.168.200.202/24
Assign the required IP address.

# nmcli  con  add  type  team-slave  con-name  team0-eth1  ifname eth1 master team0
# nmcli  con  add  type  team-slave  con-name  team0-eth2  ifname eth2 master team0
Add the two slave connections.

First Alternative course tutors can answer questions like this ... and are happy to do so. Look around our site for relevant courses in Linux -Unix - Solaris

close window