2.添加新的slave接口
我们现在可以将新的从接口 em2 添加到绑定。
# ifenslave bond0 em2
众所周知,接口绑定在提供容错和增加带宽方面非常有用。
我们可以在不中断生产工作的情况下更改bonding的主动从接口。
在下面的例子中,我们有 2 个从属接口 em0 和 em1(em1 是活动从站)的接口绑定 bond0。
我们将用新的从接口 em2 替换从接口 em0。
# 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: em0 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
on it road.com
3.分离旧的slave接口
一旦我们添加了一个新的从接口,我们就可以分离旧的从接口并将其从绑定中移除。
# ifenslave -d bond0 em0
4. 验证
确认新的从设备现在是绑定中的备用接口。
# 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
1.将活动从机改为em1
ifenslave 命令可用于从绑定中添加或者分离或者更改当前活动的从接口。
现在,将活动从接口更改为 em1.
# ifenslave -c bond0 em1
再次检查绑定状态以确保 em1 是新的活动从站:
# 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
主动从机的切换应该立即生效,但在关键生产系统上,请先安排维护窗口或者在相同的测试环境中进行一些测试。
使更改永久化
我们刚刚所做的更改是暂时的,将在服务器重新启动后清除。
为了使这些更改永久化,我们将不得不做一些更改。
确保删除文件 /etc/sysconfig/network-scripts/ifcfg-em0,因为我们不再在绑定中使用此接口。
在bonding中为新的slave接口创建一个新文件:
# rm /etc/sysconfig/network-scripts/ifcfg-em0
# vi /etc/sysconfig/network-scripts/ifcfg-em2 DEVICE=em2 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes
日期:2020-09-17 00:13:10 来源:oir作者:oir