Let’s say you have a few spare NICs and want to put them together in a (active/passive) bond. What do you do?
Well, this is pretty straight-forward.
First, connect via SSH to an IP on a NIC that WILL NOT be part of the bond.
Using ‘nmcli’ – remove references to the NICs you want IN the bond and reload nmcli:
[root@rhce ~]# nmcli con del p4p1 p4p2 Connection 'p4p1' (92d6456d-16bd-4eae-9ecb-386cb4ce4d29) successfully deleted. Connection 'p4p2' (e52eca2f-8c84-428d-8959-93e85f4b03f3) successfully deleted. [root@rhce ~]# nmcli con reload
Next, with nmcli, create the bond:
[root@rhce ~]# nmcli con add type bond ifname bond0 con-name bond0 mode active-backup miimon 100 ip4 192.168.1.50/24 Connection 'bond0' (5886c4c3-6ed7-4785-be41-7ef4c6f29373) successfully added.
Now, the bond is just an IP at this point in time; there are no NICs associated with it. Time to add the two NICs (p4p1 & p4p2) in:
[root@rhce ~]# nmcli connection add type bond-slave ifname p4p1 con-name p4p1 master bond0 Connection 'p4p1' (ef7fd007-af66-43f2-a769-a8916dbf09c9) successfully added. [root@rhce ~]# nmcli connection add type bond-slave ifname p4p2 con-name p4p2 master bond0 Connection 'p4p2' (d40213dd-4fd7-4a62-ac4c-1cc2d7480284) successfully added.
Optional (I think, but I still do it), modify the bond to have DNS:
[root@rhce ~]# nmcli connection modify bond0 ipv4.dns "192.168.1.1,184.108.40.206"
Now, ‘up’ the bond:
[root@rhce ~]# nmcli con bond0 up
It’ll take about 30 seconds to configure behind the scenes, so set up a continuous ping and wait for it to reply.
The last part of this is testing the functionality. Start a PING test, pull a cable & see what happens:
$ ping 192.168.1.50 PING 192.168.1.50 (192.168.1.50): 56 data bytes 64 bytes from 192.168.1.50: icmp_seq=52 ttl=64 time=0.357 ms 64 bytes from 192.168.1.50: icmp_seq=53 ttl=64 time=0.301 ms 64 bytes from 192.168.1.50: icmp_seq=54 ttl=64 time=0.359 ms 64 bytes from 192.168.1.50: icmp_seq=55 ttl=64 time=0.339 ms Pull active cable Request timeout for icmp_seq 6 <10-45 more times> Request timeout for icmp_seq 51 64 bytes from 192.168.1.50: icmp_seq=82 ttl=64 time=0.607 ms 64 bytes from 192.168.1.50: icmp_seq=83 ttl=64 time=0.339 ms 64 bytes from 192.168.1.50: icmp_seq=84 ttl=64 time=0.361 ms 64 bytes from 192.168.1.50: icmp_seq=85 ttl=64 time=0.276 ms 64 bytes from 192.168.1.50: icmp_seq=86 ttl=64 time=0.306 ms
Looks like you got an active/backup bond working successfully!