Redhat/Centos网卡绑定

网卡绑定功能可以起到线路冗余的效果,是一项很实用的功能

基本配置如下

绑定后的网卡

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=”bond0″
NM_CONTROLLED=”yes”
ONBOOT=”yes”
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
USERCTL=no
BONDING_OPTS=”mode=1 miimon=50″

注:mode=1为主备模式,0为负载均衡模式,交换机段需要做端口聚合

成员网卡
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=”eth0″
NM_CONTROLLED=”no”
ONBOOT=”yes”
#IPADDR=192.168.1.2
#NETMASK=255.255.255.0
MASTER=bond0
SLAVE=yes
USERCTL=no

成员网卡
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=”eth1″
NM_CONTROLLED=”no”
ONBOOT=”yes”
#IPADDR=192.168.1.2
#NETMASK=255.255.255.0
MASTER=bond0
SLAVE=yes
USERCTL=no

绑定完成后,重启网络服务(建议重启系统)

service network restart

网络重起后,bond如下所示,已成功配置
[root@localhost ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

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

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ff:3a:81

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:0c:29:ff:3a:8b

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据