RedHat / CentOS:如何在线更改当前网口 Slave的状态(bonding mode)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guyan1101/article/details/77946303

ifenslave 命令可用于连接或分离或更改当前活动的从接口与绑定。 现在,将主从接口更改

ifenslave -c bond0 em1

再次检查绑定状态以确保em1是新的active slave

cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: em1 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 5000 Down Delay (ms): 5000

Slave Interface: em0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:21:28:b2:65:26 Slave queue ID: 0

Slave Interface: em1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:21:28:b2:65:27 Slave queue ID: 0

增加新的 slave interface

ifenslave bond0 em2

删除旧的 slave interface

ifenslave -d bond0 em0

查看bond0:

cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: em1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 5000
Down Delay (ms): 5000

Slave Interface: em1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:21:28:b2:65:27
Slave queue ID: 0

Slave Interface: em2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:29:3a:c1:63:71
Slave queue ID: 0

做永久保存

rm /etc/sysconfig/network-scripts/ifcfg-em0
vi /etc/sysconfig/network-scripts/ifcfg-em2

DEVICE=em2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes

保存退出即可

猜你喜欢

转载自blog.csdn.net/guyan1101/article/details/77946303
今日推荐