网卡配置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 interfaceauto loiface lo inet loopback# The primary network interfacezauto eno1np0iface eno1np0 inet staticbond-master bond4auto eno2np1iface eno2np1 inet staticbond-master bond4auto bond4iface bond4 inet staticaddress 10.0.30.74/24gateway 10.0.30.1bond-mode 802.3ad #网卡模式 mode 4bond-slaves eno1np0 eno2np1 #所绑定的网卡bond-miimon 100 #网卡状态监测周期100msbond-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/bond4Ethernet Channel Bonding Driver: v5.10.0-0.bpo.4-amd64Bonding Mode: IEEE 802.3ad Dynamic link aggregationTransmit Hash Policy: layer2 (0)MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Peer Notification Delay (ms): 0802.3ad infoLACP rate: slowMin links: 0Aggregator selection policy (ad_select): stableSystem priority: 65535System MAC address: bc:97:e1:02:26:10Active Aggregator Info:Aggregator ID: 1Number of ports: 2Actor Key: 15Partner Key: 1089Partner Mac Address: 88:40:33:59:f1:a0Slave Interface: eno1np0MII Status: upSpeed: 10000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: bc:97:e1:02:26:10Slave queue ID: 0Aggregator ID: 1Actor Churn State: nonePartner Churn State: noneActor Churned Count: 0Partner Churned Count: 0details actor lacp pdu:system priority: 65535system mac address: bc:97:e1:02:26:10port key: 15port priority: 255port number: 1port state: 61details partner lacp pdu:system priority: 32768system mac address: 88:40:33:59:f1:a0oper key: 1089port priority: 32768port number: 3port state: 61Slave Interface: eno2np1MII Status: upSpeed: 10000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: bc:97:e1:02:26:11Slave queue ID: 0Aggregator ID: 1Actor Churn State: nonePartner Churn State: noneActor Churned Count: 0Partner Churned Count: 0details actor lacp pdu:system priority: 65535system mac address: bc:97:e1:02:26:10port key: 15port priority: 255port number: 2port state: 61details partner lacp pdu:system priority: 32768system mac address: 88:40:33:59:f1:a0oper key: 1089port priority: 32768port number: 4port state: 61
