歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

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

Copyright © Linux教程網 All Rights Reserved