链路聚合
网卡的链路聚合就是将多块网卡连接起来,当一块网卡损坏,网络依旧可以正常运行,可以有效的防止因为网卡损坏带来的损失,同时也可以提高网络访问速度。
网卡的链路聚合方式:
bond:最多可以添加两块网卡
team:最多可以添加八块网卡
bond的常用的2种模式:
bond0(balance-rr)
bond0用于负载轮询(2个网单独都是100MB,聚合为1个网络传输带宽为200MB)
bond1(active-backup)
bond1用于高可用,其中一条线若断线,其他线路将会自动备援
--> eth0 ----\
app --发送数据到--> bond0 <---> switch
--> eth1 ----/
链路聚合配置
bond聚合
bond0test
[root@cjy ~]# nmcli device
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
ens192 ethernet connected Wired connection 1
ens224 ethernet connected Wired connection 2
lo loopback connected (externally) lo
创建bond0, 模式为balance-rr
[root@cjy ~]# nmcli connection add type bond mode balance-rr con-name bond0 ifname bond0 ipv4.method manual ipv4.addresses 192.168.159.250/24 ipv4.gateway 192.168.159.2 ipv4.dns 192.168.159.2
Connection 'bond0' (2715a7c6-668b-4487-9be1-733a7eb04bd0) successfully added.
添加物理网卡连接至bond0
[root@cjy ~]# nmcli connection add type bond-slave con-name bond-slave0 ifname ens192 master bond0
Connection 'bond-slave0' (c9e7e854-4208-403e-8d56-d90da7d645a2) successfully added.
[root@cjy ~]# nmcli connection add type bond-slave con-name bond-slave1 ifname ens224 master bond0
Connection 'bond-slave1' (2923a403-6998-45fb-b9f6-7fe467b514e8) successfully added.
激活bond-slave0和bond-slave1
[root@cjy ~]# nmcli connection up bond-slave0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@cjy ~]# nmcli connection up bond-slave1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
查看bond配置信息
[root@cjy ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v5.14.0-362.8.1.el9_3.x86_64
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
Slave Interface: ens192
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1:27
Slave queue ID: 0
Slave Interface: ens224
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:b5:d1: