I wanted to have a look at the NetworkManager utilities in CentOS 7 so I thought I’d test out a teamed (aka bonded) interface. So here’s my setup.
Setup looks like the following.
So now on to the config. I’ll be using the nmcli command line utility to configure it in an active-backup setup. First create the teamed interface.
1 2 |
nmcli connection add type bond ifname bond0 con-name bond0 mode active-backup primary enp0s8 miimon 200 ip4 192.168.56.101 gw4 192.168.56.1 Connection 'bond0' (2056c502-0225-4171-8916-665883192864) successfully added. |
One thing I found out early was that I needed to set the fail_over_mac parameter to 1 as Virtual Box does not like the bond to get the same MAC address for all nics. Setting this parameter means the bond will get the MAC of the active nic.
1 |
nmcli con mod bond0 +bond.options fail_over_mac=1 |
Now I can add the slaves.
1 2 |
nmcli connection add type bond-slave ifname enp0s8 master bond0 nmcli connection add type bond-slave ifname enp0s9 master bond0 |
Startup up all the components.
1 2 3 |
nmcli c u bond0 nmcli c u bond-slave-enp0s8 nmcli c u bond-slave-enp0s9 |
We can check our setup and it looks good for now.
1 2 3 4 5 6 7 8 9 |
================================================================================= NetworkManager active profiles ================================================================================= NAME UUID TYPE DEVICE --------------------------------------------------------------------------------- bond0 2056c502-0225-4171-8916-665883192864 bond bond0 bond-slave-enp0s8 e61588b1-538d-4f3b-83cc-6bcd5bc50afb 802-3-ethernet enp0s8 enp0s3 74502bfb-de0c-4c0b-9236-2bab0d1ff2e2 802-3-ethernet enp0s3 bond-slave-enp0s9 8bd3f6c0-d6e1-4401-b5f5-cd8661076c74 802-3-ethernet enp0s9 |
And now we can down some interfaces and see the bonding in action.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[root@centos7 ~]# ifdown enp0s8 Device 'enp0s8' successfully disconnected. [root@centos7 ~]# ip addr show bond0 5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether 08:00:27:d4:02:84 brd ff:ff:ff:ff:ff:ff inet 192.168.56.101/32 brd 192.168.56.101 scope global bond0 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fed4:284/64 scope link valid_lft forever preferred_lft forever [root@centos7 ~]# nmcli con up bond-slave-enp0s8 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6) [root@centos7 ~]# ip addr show bond0 5: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether 08:00:27:c6:c0:55 brd ff:ff:ff:ff:ff:ff inet 192.168.56.101/32 brd 192.168.56.101 scope global bond0 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fed4:284/64 scope link valid_lft forever preferred_lft forever |
Our network connectivity survived and we can see from the above the MAC address for the bond changed to the active nic.