在Oracle Linux上配置容错网络绑定
时间:2020-03-21 11:42:56 来源:igfitidea点击:
我们将在Oracle Linux 6上配置主动备份网络绑定。
准备工作
我们有两个网卡eth0和eth1,将创建一个具有active-backup策略的bond0接口,其中绑定中只有一个从属处于活动状态。
当且仅当活动的从站发生故障时,另一个从站才变为活动状态。
配置bond0接口
打开“/etc/sysconfig/network-scripts/ifcfg-bond0”并添加以下行:
DEVICE=bond0 BONDING_OPTS="mode=1 miimon=100" IPADDR="10.10.1.20" NETMASK="255.255.255.0" GATEWAY"10.10.1.1" PEERDNS=no NM_CONTROLLED=no BOOTPROTO=none USERCTL=no ONBOOT=yes
确保根据配置更改IP。
配置eth0和eth1接口
打开“/etc/sysconfig/network-scripts/ifcfg-eth0”并添加以下行:
DEVICE=eth0 MASTER=bond0 SLAVE=yes BOOTPROTO=none USERCTL=no ONBOOT=yes
打开“/etc/sysconfig/network-scripts/ifcfg-eth1”并添加以下行:
DEVICE=eth1 MASTER=bond0 SLAVE=yes BOOTPROTO=none USERCTL=no ONBOOT=yes
配置Modprobe
打开“ /etc/modprobe.conf”并添加以下行:
alias bond0 bonding
如果不存在,则创建“ /etc/modprobe.conf”文件。
确保绑定模块已加载:
# modprobe bonding
重新启动网络服务:
# service network restart
检查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: eth0 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:11:22:33:44:55 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 00:11:22:33:44:56 Slave queue ID: 0
我们看到已对其进行了容错配置,并且活动的从站为eth0。
要测试,请关闭eth0接口:
# ifconfig eth0 down
并再次检查绑定配置:
# 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: eth1 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: down Speed: 10000 Mbps Duplex: full Link Failure Count: 2 Permanent HW addr: 00:11:22:33:44:55 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 00:11:22:33:44:56 Slave queue ID: 0
我们看到现在活动的从属网口是eth1.