Linux system configuration link aggregation

1. Add a network card to the virtual machine

2. Through ip addr, you can see that there is an additional ens36 network card

ip addr

3. Create bond0

nmcli connection add type bond con-name mybond0 ifname bond0 mode active-backup ipv4.method manual ipv4.address 192.168.100.100/24 ​​#Add bonding interface, mode active-backup mode and set ip

nmcli connection add type bond-slave ifname ens33 master bond0 #add slave interface ens33

nmcli connection add type bond-slave ifname ens36 master bond0 #add slave interface ens36

nmcli connection up bond-slave-ens33 #Start the slave interface ens33 first

nmcli connection up bond-slave-ens36 #Start the slave interface ens36 first

nmcli conn up mybond0 #Start bonding

Through the ip addr command, you can see that the ens33 ens36 network card has no ip address, and the mac address is the same

ip addr

cat /proc/net/bonding/bond0 #View this file to see that the current main network card is ens33, and ens36 is the backup

4. Test

Disconnect the ens33 interface, you can see that the network lost a packet and reconnect it

ifdown ens33 The ifdown command is used to disable the specified network interface

ifup ens33 fup command - activate network interface

Test disconnecting a network card, you can see that the network is still connected after a few packets are lost during switching.

Enable ens33, disconnect ens36, you can see that the network reconnects normally after losing a packet

fdown ens36 The ifdown command is used to disable the specified network interface

ifup ens36 fup command - activate network interface

Test disconnecting a network card, you can see that the network is still connected after a few packets are lost during switching.

The network is interrupted after disconnecting both network cards4d14ac0c44f116a1e284f91a1c2111f5.png

Guess you like

Origin blog.csdn.net/h20040928/article/details/128253577