马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!网卡绑定就是多张网卡逻辑上作为一张网卡用。可分为,负载平衡绑定和冗余绑定两种。
1.编纂虚拟收集接口设置装备摆设文件
[root@test~]#more/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=172.16.4.100
NETMASK=255.255.255.0
BROADCAST=172.16.4.255
NETWORK=172.168.4.100
ONBOOT=yes
2.编纂各网卡的设置装备摆设文件,留意编纂之前做好备份任务
[root@test~]#more/etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=none
TYPE=Ethernet
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
slave=yes
[root@test~]#more/etc/sysconfig/network-scripts/ifcfg-eth1
BOOTPROTO=none
TYPE=Ethernet
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
slave=yes
3.修正/etc/modprobe.conf文件,异样做好备份,最初参加2行
aliasbond0bonding
optionsbond0miimon=100mode=1
注:
(1)、miimon是链路监测的时光距离单元是毫秒,miimon=100的意思就是,每100毫秒检测网卡和交流机之间能否连通,如欠亨则应用别的的链路。
(2)、mode=0表现负载平衡方法,两块网卡都任务,须要交流机作支撑
mode=1表现冗余方法,网卡只要一个任务,一个出成绩启用别的的
mode=6表现负载平衡方法,两块网卡都任务,不须要交流机作支撑
[root@test~]#more/etc/modprobe.conf
aliaseth0b44
aliaseth18139too
aliasusb-controllerehci-hcd
aliasusb-controller1ohci-hcd
aliasbond0bonding
optionsbond0miimon=100mode=0
4.在/etc/rc.d/rc.local参加以下一行
ifenslavebond0eth0eth1
[root@test~]#more/etc/rc.d/rc.local
#!/bin/sh
#
#Thisscriptwillbeexecuted*after*alltheotherinitscripts.
#Youcanputyourowninitializationstuffinhereifyoudont
#wanttodothefullSysVstyleinitstuff.
touch/var/lock/subsys/local
ifenslavebond0eth0eth1
5.从新启动后负载均衡曾经能正常任务,servicenetworkrestart,
6.检查bond0的任务状况
[root@test~]#more/proc/net/bonding/bond0
EthernetChannelBondingDriver:v2.6.1(October29,2004)
BondingMode:loadbalancing(round-robin)
MIIStatus:up
MIIPollingInterval(ms):100
UpDelay(ms):0
DownDelay(ms):0
SlaveInterface:eth0
MIIStatus:up
LinkFailureCount:1
PermanentHWaddr:00:1b:b9:58:8b:b2
SlaveInterface:eth1
MIIStatus:down
LinkFailureCount:0
PermanentHWaddr:00:07:40:6c:ac:c8
7.检查经由绑定后的网卡任务情形
[root@test~]#ifconfig-a
bond0Linkencap:EthernetHWaddr00:1B:B9:58:8B:B2
inetaddr:172.16.4.100Bcast:172.16.4.255Mask:255.255.255.0
inet6addr:fe80::200:ff:fe00:0/64Scope:Link
UPBROADCASTRUNNINGMASTERMULTICASTMTU:1500Metric:1
RXpackets:744154errors:0dropped:0overruns:0frame:0
TXpackets:1866915errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:1099876146(1.0GiB)TXbytes:121233595(115.6MiB)
eth0Linkencap:EthernetHWaddr00:1B:B9:58:8B:B2
inet6addr:fe80::21b:b9ff:fe58:8bb2/64Scope:Link
UPBROADCASTRUNNINGSLAVEMULTICASTMTU:1500Metric:1
RXpackets:744154errors:0dropped:0overruns:0frame:0
TXpackets:1866905errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:1099876146(1.0GiB)TXbytes:121232839(115.6MiB)
Interrupt:9
eth1Linkencap:EthernetHWaddr00:1B:B9:58:8B:B2
inet6addr:fe80::21b:b9ff:fe58:8bb2/64Scope:Link
UPBROADCASTSLAVEMULTICASTMTU:1500Metric:1
RXpackets:0errors:0dropped:0overruns:0frame:0
TXpackets:10errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:1000
RXbytes:0(0.0b)TXbytes:756(756.0b)
Interrupt:11Baseaddress:0x1000
loLinkencap:LocalLoopback
inetaddr:127.0.0.1Mask:255.0.0.0
inet6addr:::1/128Scope:Host
UPLOOPBACKRUNNINGMTU:16436Metric:1
RXpackets:2129errors:0dropped:0overruns:0frame:0
TXpackets:2129errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:1998893(1.9MiB)TXbytes:1998893(1.9MiB)
sit0Linkencap:IPv6-in-IPv4
NOARPMTU:1480Metric:1
RXpackets:0errors:0dropped:0overruns:0frame:0
TXpackets:0errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0
RXbytes:0(0.0b)TXbytes:0(0.0b)
附:
DEVICE=物理装备名
IPADDR=IP地址
NETMASK=掩码值
NETWORK=收集地址
BROADCAST=播送地址
GATEWAY=网关地址
ONBOOT=[yes|no](引诱时能否激活装备)
USERCTL=[yes|no](非root用户能否可以掌握该装备)
BOOTPROTO=[none|static|bootp|dhcp](引诱时不应用协定|静态分派|BOOTP协定|DHCP协定)
HWADDR=你的MAC地址
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们! |