Linux Beginner-Link aggregation for NIC
Network card link aggregation is to connect a number of network cards, when a NIC damage, the network can still run normally, can effectively prevent damage caused by network card loss, but also improve network access speed.
The link aggregation of network card is commonly used with "bond" and "team" two modes, "Bond" mode can add up to two network cards, "team" mode can add up to eight network cards.
1. Bond
The configuration steps for Bond mode are as shown in two network cards before configuration:
A, "NMCLI connection Add type Bond con-name bond0 mode active-backup ip4 172.25.254.102/24". Add a bond, name BOND0, working mode is the main standby, IP is "172.25.254.102".
B, "Cat/proc/net/bonding/bond0". You can view the information for Bond.
C, "NMCLI connection add con-name eth0 ifname eth0 type Bond-slave master Bond0". Add the eth0 NIC connection to this bond.
D, "nmcli connection add con-name eth1 ifname eth1 type Bond-slave master Bond0". Add the Eth1 connection card to this bond.
The NIC link aggregation configuration for Bond mode is complete and the network can be used normally.
The common working modes of bond are "active-backup" and "BALANCE-RR" polling mode. The main standby mode is the use of a network card, this NIC is bad to use another NIC. Polling mode is used by two NICs in turn.
Test can use "ifconfig eth0 down", remove a network card, you can find that the network can still be used normally.
You can use "NMCLI connection delete eth0" To remove this network connection.
Use the command "NMCLI connection add con-name eth0 ifname eth0 type Bond-slave master Bond0" to re-add a NIC. This NIC becomes the standby network card.
If you need to remove link aggregation from Bond mode, enter the command "NMCLI connection delete bond0", "NMCLI connection delete eth0", "NMCLI connection Delete eth1" one time.
2. Team
Team mode can add up to eight network cards, the following is the example of two blocks, the configuration steps are as follows:
A, "MCLI connection Add type team con-name TEAM0 ifname team0 config ' {" runner ": {" name ":" Activebackup "}} ' Ip4 172.25.254.10 2/24 ". Indicates the establishment of a team, the name is TEAM0, the working mode is the main standby, the IP is "172.25.254.102".
B, "Teamdctl team0 State". You can view information for Team mode.
C, "NMCLI connection add con-name eth0 ifname eth0 type Team-slave master Team0". Add the Eth0 network connection to the team.
D, "nmcli connection add con-name eth1 ifname eth1 type Team-slave master Team0". Add the Eth1 network connection to the team.
Now that the link aggregation configuration for Team mode is complete, you can see that the eth0 is currently working, and the network is connected.
Team mode is different from Bond mode, there are four kinds, namely "broadcast" broadcast fault tolerance, "roundrobin" balanced polling, "activebackup" and "loadbalance" load balancing. The work mode commands in the command are also different when you add team mode, and the command format for Team mode is ' {' runner ': {' name ': ' Working Mode '} ', which requires attention.
Test is also through the "Ifconfig eth0 down", remove a NIC, you can see the network is still connected.
The team is deleted in the same way as the bond mode.
This is commonly used in two network card link aggregation mode, network card link aggregation to the normal operation of the enterprise has a great effect, according to different work needs to use different working mode.
Linux Beginner-Link aggregation for NIC