Centos7环境下配置IEEE 802.3ad 动态链接聚合(bond4)
环境:Centos7.6、Vmware添加2块网卡查看网卡配置文件[root@linux ~]# ls /etc/sysconfig/network-scripts/ | grep ensifcfg-ens33# 查看发现只有一个网卡的配置文件,因此需要复制一份,并且重命名为第二块网卡的名字,网卡的名字可以通过ip addr查看[root@linux ~]# cd /etc/sysconfig/n
·
环境:Centos7.6、Vmware
- 添加2块网卡
- 查看网卡配置文件
[root@linux ~]# ls /etc/sysconfig/network-scripts/ | grep ens
ifcfg-ens33
# 查看发现只有一个网卡的配置文件,因此需要复制一份,并且重命名为第二块网卡的名字,网卡的名字可以通过ip addr查看
[root@linux ~]# cd /etc/sysconfig/network-scripts/
[root@linux network-scripts]# cp ifcfg-ens33 ifcfg-ens36
[root@linux network-scripts]# ls | grep ens
ifcfg-ens33
ifcfg-ens36
- 修改网卡ens33配置文件
[root@linux ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond4
SLAVE=yes
USERCTL=no
- 修改网卡ens36配置文件
[root@linux ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens36
DEVICE=ens36
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond4
SLAVE=yes
USERCTL=no
- 创建虚拟网卡bond4
[root@linux ~]# touch /etc/sysconfig/network-scripts/ifcfg-bond4
[root@linux ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond4
DEVICE=bond4
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.119.140
GATEWAY=192.168.119.1
NAME=bond4
BONDING_OPTS="miimon=100 mode=4 lacp_rate=1 fail_over_mac=1"
- 加载模块
[root@linux network-scripts]# touch /etc/modprobe.d/bond.conf
[root@linux network-scripts]# cat /etc/modprobe.d/bond.conf
alias bond4 bonding
options bond4 miimon=100 mode=4 fail_over_mac=1 # # miimon:多长时间检查一次网络,单位ms;
[root@oraclelinux ~]# modprobe bonding
- 重启网卡
[root@linux ~]# systemctl restart network
- 查看bonding目前状态
[root@linux ~]# cat /proc/net/bonding/bond4
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
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
802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: 00:0c:29:80:5c:77
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 1
Actor Key: 9
Partner Key: 1
Partner Mac Address: 00:00:00:00:00:00
Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:80:5c:77
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: monitoring
Partner Churn State: monitoring
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: 00:0c:29:80:5c:77
port key: 9
port priority: 255
port number: 1
port state: 207
details partner lacp pdu:
system priority: 65535
system mac address: 00:00:00:00:00:00
oper key: 1
port priority: 255
port number: 1
port state: 3
Slave Interface: ens36
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:80:5c:81
Slave queue ID: 0
Aggregator ID: 2
Actor Churn State: monitoring
Partner Churn State: monitoring
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
system mac address: 00:0c:29:80:5c:77
port key: 9
port priority: 255
port number: 2
port state: 199
details partner lacp pdu:
system priority: 65535
system mac address: 00:00:00:00:00:00
oper key: 1
port priority: 255
port number: 1
port state: 3
更多推荐
已为社区贡献1条内容
所有评论(0)