网卡绑定是指多个网卡在逻辑上用作一个网卡。 分为负载均衡绑定和冗馀绑定两种。
1 .编辑虚拟网络接口配置文件[根@测试~ ] # more/etc/sys config/network-scripts/if CFG-bond 0
设备=bond 0
IPADDR=172.16.4.100
NETMASK=255.255.255.0
BROADCAST=172.16.4.255
网络=172.168.4.100
on boot=是
2 .注意编辑每个网卡的配置文件,并在编辑前进行备份[根@测试~ ] # more/etc/sys config/network-scripts/if CFG-eth 0
BOOTPROTO=none
type=以太网
设备=eth 0
on boot=是
老板-邦德0
slave=是
[根@ test~] # more/etc/sys config/network-scripts/if CFG-et h1
BOOTPROTO=none
type=以太网
设备=et h1
on boot=是
老板-邦德0
slave=是
修改/etc/modprobe.conf文件,以同样的方式创建备份,最后添加两行
alias bond 0绑定
选项板0 miimon=100 mode=1
注:
(1)链路监控的时间间隔单位为毫秒,miimon=100意味着每100毫秒检测网卡与交换机之间是否连接,如果不通,则使用另一个链路。
) 2、mode=0表示负载均衡方式,两张网卡运行,需要交换机支持
mode=1表示冗馀方式,网卡只有一个工作,一个有问题启用另一个
mode=6表示负载平衡方案,两个网卡都可以工作,不需要支持交换机[ root @ test~] # more/etc/modprobe.conf
alias eth0 b44
alias eth1 8139too
alias us B-控制器ehci-HCD
alias USB-controller1ohci-hcdaliasbond 0绑定
选项板0 miimon=100 mode=0
在/etc/rc.d/rc.local中添加以下行
ifenslave bond0eth0eth1[ root @ test~] # more/etc/RC.d/RC.local
#! /kqdyt/sh
#
# thisscriptwillbeexecuted * after * alltheotherinitscripts。
# youcanputyourowninitializationstuffinhereifyoudon ' t
# wanttodothefullsysvstyleinitstuff。
touch/var/lock/subsys/local http://www.Sina.com /
5 .重新启动后,负载平衡现在可以正常运行。 查看服务网络重启,bond0的工作状态[ root @ test~] # more/proc/net/bonding/bond 0
以太网通道绑定驱动程序: v2.6.1(October 29,2004 )。
绑定模式:加载平衡(round-rokqdyt )。
MII Status: up
微轮询间隔(ms ) : 100
上行延迟(ms ) : 0
下行延迟(ms ) : 0
Slave接口: eth 0
MII Status: up
link故障计数: 1
permanent hwaddr 33600033601 b : b 93360 b 933605833608 b : b 2
Slave接口: et h1
MII status :下装
link故障计数: 0
permanent hwaddr 33600033600733604033606 c : AC : c 8
7 .查看绑定网卡的运行状况[root@test ~]# ifconfig -a
bond0link encap :以太网hwaddr 0033601 b : b 93360 b 933605833608 b : b 2
inetaddr 3360172.16.4.100 bcast :172.16.4.255 mask :255.255.255.255.255.255.255.255.255
inet6addr : Fe 80336033602003360 ff : Fe 0033600/64 scope : link
upbroadcastrunningmastermulticastmtu 33601500公制:1
rx包3360744154 errors :0 dropped :0 over runs :0 frame :0
tx packets 33601866915 errors :0 dropped :0 over runs :0 carrier :0
collisions :0 txqueuelen :0
rxbytes:1099876146(1.0GIB ) tx bytes :121233595 (115.6 MIB )
eth0link encap :以太网hwaddr 0033601 b : b 9336005833608 b : b 2
inet6addr : Fe 803360336021 b : B9 ff : Fe 5833608 bb2/64 scope : link
upbroadcastrunningslavemulticastmtu 33601500公制:1
rx包3360744154 errors :0 dropped :0 over runs :0 frame :0
tx packets 33601866905 errors :0 dropped :0 over runs :0 carrier :0
collisions :0 txqueuelen :1000
rxbytes:1099876146(1.0GIB ) tx bytes :121232839 (115.6 MIB )
Interrupt:9
et h1 link encap :以太网hwaddr 0033601 b : b 9336005833608 b : b 2
inet6addr : Fe 803360336021 b : B9 ff : Fe 5833608 bb2/64 scope : link
upbroadcastslavemulticastmtu :1500公制:1
rx包:0 errors :0 dropped :0 over runs :0 frame :0
tx packets 336010 errors :0 dropped :0 over runs :0 carrier :0
collisions :0 txqueuelen :1000
rx字节:0 (0.0b ) tx字节:756 (756.0 b ) )。
interrupt :11 base address :0 x 1000
lo link encap :本地loopback
inetaddr :127.0.0.1 mask :255.0.0.0
inet6addr 3360336033601/128 scope : host
uploopbackrunningmtu :16436公制:1
rx包33602129 errors :0 dropped :0 over runs :0 frame :0
tx packets 33602129 errors :0 dropped :0 over runs :0 carrier :0
collisions :0 txqueuelen :0
rxbytes:1998893(1.9MIB ) rxbytes:1998893(1.9MIB )
s it0 link encap : ipv 6合1 IP v4
noarp MTU :1480公制:1
rx包:0 errors :0 dropped :0 over runs :0 frame :0
tx packets 33600 errors :0 dropped :0 over runs :0 carrier :0
collisions :0 txqueuelen :0
rx bytes :0 (0.0b tx bytes :0 (0.0b ) )。
附件:
设备=物理设备名称
IPADDR=IP地址
NETMASK=掩码值
网络=网络地址
BROADCAST=广播地址
网关=网关地址
ONBOOT=[yes|no] (启动时是否激活设备) ) ) ) ) ) ) ) ) ) )。
user CTL=[ yes|no (非根用户是否可以控制设备) ] ) ) ) ) )。
boot proto=[ none ]静态(启动时不使用协议|静态分配|BOOTP协议) ) )
HWADDR=你的MAC地址