本文主要是介绍CentOS 7.6 bond mode4 配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
CentOS 7.6 bond mode4 配置
- CentOS 7.6 bond mode4 配置
- 双网卡配置 bond mode4 配置
- 创建配置文件 ifcfg-bond0
- 如果bond0接口已经配置,不再需要配置
- 备份网卡配置文件
- ens3f0
- ens3f1
- 查看bond0信息
- 查看bond0 速率
- 交换机配置 lacp
- 防火墙
- ~~网速测试~~
- 服务端
- 参考
CentOS 7.6 bond mode4 配置
双万兆网口配置 bond mode4 layer3+4
双网卡配置 bond mode4 配置
# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
yum search ifconfig
yum install net-tools.x86_64
- 查看网线是否插入
# cat /sys/class/net/ens3f0/carrier
1
# cat /sys/class/net/ens3f1/carrier
1
- 关闭 NetworkManager 服务
systemctl status NetworkManager.service
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
- 内核加载 bonding
modprobe --first-time bonding
# lsmod | grep bonding
bonding 152656 0
创建配置文件 ifcfg-bond0
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Bond
IPADDR=192.168.2.11
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
DNS1=114.114.114.114
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="miimon=100 mode=4 xmit_hash_policy=layer3+4"
如果bond0接口已经配置,不再需要配置
vim /etc/modprobe.d/bond.conf
alias bond0 bonding
options bond0 miimon=100 mode=4 xmit_hash_policy=layer3+4
备份网卡配置文件
cd /etc/sysconfig/network-scripts
cp ifcfg-ens3f0 ifcfg-ens3f0_backup
cp ifcfg-ens3f1 ifcfg-ens3f1_backup
ens3f0
vim /etc/sysconfig/network-scripts/ifcfg-ens3f0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens3f0
UUID=39aa32a1-acb3-4cd3-a806-be5c041a2310
DEVICE=ens3f0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
ens3f1
vim /etc/sysconfig/network-scripts/ifcfg-ens3f1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens3f1
UUID=4b5c8908-3e83-40b2-a9db-d0713135f4c2
DEVICE=ens3f1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
- 重启网络服务
systemctl restart network
# ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500inet 192.168.2.11 netmask 255.255.255.0 broadcast 192.168.2.255
查看bond0信息
cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer3+4 (1)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: bc:16:95:07:97:b0
Active Aggregator Info:Aggregator ID: 1Number of ports: 1Actor Key: 15Partner Key: 1Partner Mac Address: 00:00:00:00:00:00Slave Interface: ens3f0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: bc:16:95:07:97:b0
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: churned
Actor Churned Count: 0
Partner Churned Count: 1
details actor lacp pdu:system priority: 65535system mac address: bc:16:95:07:97:b0port key: 15port priority: 255port number: 1port state: 77
details partner lacp pdu:system priority: 65535system mac address: 00:00:00:00:00:00oper key: 1port priority: 255port number: 1port state: 1Slave Interface: ens3f1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: bc:16:95:07:97:b1
Slave queue ID: 0
Aggregator ID: 2
Actor Churn State: churned
Partner Churn State: churned
Actor Churned Count: 1
Partner Churned Count: 1
details actor lacp pdu:system priority: 65535system mac address: bc:16:95:07:97:b0port key: 15port priority: 255port number: 2port state: 69
details partner lacp pdu:system priority: 65535system mac address: 00:00:00:00:00:00oper key: 1port priority: 255port number: 1port state: 1
查看bond0 速率
ethtool bond0
Settings for bond0:Supported ports: [ ]Supported link modes: Not reportedSupported pause frame use: NoSupports auto-negotiation: NoSupported FEC modes: Not reportedAdvertised link modes: Not reportedAdvertised pause frame use: NoAdvertised auto-negotiation: NoAdvertised FEC modes: Not reportedSpeed: 10000Mb/sDuplex: FullPort: OtherPHYAD: 0Transceiver: internalAuto-negotiation: offLink detected: yes
交换机配置 lacp
Speed: 20000Mb/s 速率
# ethtool bond0
Settings for bond0:Supported ports: [ ]Supported link modes: Not reportedSupported pause frame use: NoSupports auto-negotiation: NoSupported FEC modes: Not reportedAdvertised link modes: Not reportedAdvertised pause frame use: NoAdvertised auto-negotiation: NoAdvertised FEC modes: Not reportedSpeed: 20000Mb/sDuplex: FullPort: OtherPHYAD: 0Transceiver: internalAuto-negotiation: offLink detected: yes
防火墙
# firewall-cmd --state
running
systemctl stop firewalld.service
网速测试
yum install -y iperf3
服务端
iperf3 -s
iperf3 -c 192.168.0.1服务端IP
参考
Centos7双网卡绑定配置 bonding
centos 链路捆绑(聚合)bonding配置举例
Centos 7 安装 iperf和服务器之间测速
这篇关于CentOS 7.6 bond mode4 配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!