网卡配置bond mode 4,前提交换机端口开启静态LACP模式
1、安装 ifenslave
ifenslave作用是网卡的负载均衡
apt-get install ifenslave -y
2、编辑 /etc/network/interfaces 配置文件
root@fvts-host-cn-alpha:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interfacez
auto eno1np0
iface eno1np0 inet static
bond-master bond4
auto eno2np1
iface eno2np1 inet static
bond-master bond4
auto bond4
iface bond4 inet static
address 10.0.30.74/24
gateway 10.0.30.1
bond-mode 802.3ad #网卡模式 mode 4
bond-slaves eno1np0 eno2np1 #所绑定的网卡
bond-miimon 100 #网卡状态监测周期100ms
bond-downdelay 200 #网卡down时间
bond-updelay 200 #网卡up时间
3、开机自动加载bonding模块
root@fvts-host-cn-alpha:~# vim /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
bonding #添加这行
4、重启服务器
reboot
验证
root@fvts-host-cn-alpha:~# cat /proc/net/bonding/bond4
Ethernet Channel Bonding Driver: v5.10.0-0.bpo.4-amd64
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0
802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: bc:97:e1:02:26:10
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 15
Partner Key: 1089
Partner Mac Address: 88:40:33:59:f1:a0
Slave Interface: eno1np0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: bc:97:e1:02:26:10
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: bc:97:e1:02:26:10
port key: 15
port priority: 255
port number: 1
port state: 61
details partner lacp pdu:
system priority: 32768
system mac address: 88:40:33:59:f1:a0
oper key: 1089
port priority: 32768
port number: 3
port state: 61
Slave Interface: eno2np1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: bc:97:e1:02:26:11
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: bc:97:e1:02:26:10
port key: 15
port priority: 255
port number: 2
port state: 61
details partner lacp pdu:
system priority: 32768
system mac address: 88:40:33:59:f1:a0
oper key: 1089
port priority: 32768
port number: 4
port state: 61