当前位置: 首页 > LINUX > 正文

RHEL 6.6 比网卡绑定测试

下面是在RHEL6.6上配置双网卡绑定,在RHEL 6配置与RHEL 5配置有一点不相同,只是修改的文件不一样,原理是一样的,下面以主备来测试:

1,版本介绍

[root@localhost ~]# lsb_release -a

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

Distributor ID: RedHatEnterpriseServer

Description:    Red Hat Enterprise Linux Server release 6.6 (Santiago)

Release:        6.6

Codename:       Santiago

2,加载bonding模块

默认双网卡绑定模块是没有加载的,第一次需要手动加载,以后会自动加载,不需要做其它的配置,在RHEL 5中需要把加载手动写到/etc/rc.local文件中,每次启动的时候自动加载。

[root@localhost modules]# lsmod|grep bond

[root@localhost modules]# modprobe –first-time bonding

[root@localhost modules]# lsmod|grep bonding

bonding               130997  0

8021q                  25527  1 bonding

ipv6                  334932  272 bonding,ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6

3,配置网卡配置文件

这里可以不用禁用networkmanager服务,但是是需要在配置文件中增加

NM_CONTROLLED=no此参数,不过还是建议禁用。

 

echo "DEVICE=bond0

IPADDR=192.168.111.30

NETMASK=255.255.255.0

ONBOOT=yes

BOOTPROTO=none

USERCTL=no

NM_CONTROLLED=no

IPV6INIT=no

#from mos 1642955.1

BONDING_OPTS=\"mode=active-backup miimon=100 downdelay=5000 updelay=5000 num_grat_arp=100\"">/etc/sysconfig/network-scripts/ifcfg-bond0

 

echo "DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes

USERCTL=no

IPV6INIT=no

HOTPLUG=no

CONNECTED_MODE=yes

NM_CONTROLLED=no">/etc/sysconfig/network-scripts/ifcfg-eth0

 

echo "DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes

USERCTL=no

IPV6INIT=no

HOTPLUG=no

CONNECTED_MODE=yes

NM_CONTROLLED=no">/etc/sysconfig/network-scripts/ifcfg-eth1

 

echo "DEVICE=bond1

IPADDR=192.168.112.30

NETMASK=255.255.255.0

ONBOOT=yes

BOOTPROTO=none

USERCTL=no

IPV6INIT=no

NM_CONTROLLED=no

#from mos 1642955.1

BONDING_OPTS=\"mode=active-backup miimon=100 downdelay=5000 updelay=5000 num_grat_arp=100\"">/etc/sysconfig/network-scripts/ifcfg-bond1

 

 

 

echo "DEVICE=eth2

BOOTPROTO=none

ONBOOT=yes

MASTER=bond1

SLAVE=yes

USERCTL=no

IPV6INIT=no

HOTPLUG=no

CONNECTED_MODE=yes

NM_CONTROLLED=no">/etc/sysconfig/network-scripts/ifcfg-eth2

 

echo "DEVICE=eth3

BOOTPROTO=none

ONBOOT=yes

MASTER=bond1

SLAVE=yes

USERCTL=no

IPV6INIT=no

HOTPLUG=no

CONNECTED_MODE=yes

NM_CONTROLLED=no">/etc/sysconfig/network-scripts/ifcfg-eth3

 

重启网卡服务

/etc/init.d/network restart

生产环境建议使用ifup/ifdown来操作。不会影响其它的网卡。

4,查看绑定信息

[root@www.htz.pw ~]# cat cat /proc/net/bonding/bond0

cat: cat: No such file or directory

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 0

Up Delay (ms): 0

Down Delay (ms): 0

 

Slave Interface: eth0

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:0a:65:58

Slave queue ID: 0

 

Slave Interface: eth1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:0a:65:62

Slave queue ID: 0

[root@www.htz.pw ~]# cat cat /proc/net/bonding/bond1

cat: cat: No such file or directory

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth2

MII Status: up

MII Polling Interval (ms): 0

Up Delay (ms): 0

Down Delay (ms): 0

 

Slave Interface: eth2

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:0a:65:6c

Slave queue ID: 0

 

Slave Interface: eth3

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: 00:0c:29:0a:65:76

Slave queue ID: 0

 

 

[root@www.htz.pw ~]# ifconfig

bond0     Link encap:Ethernet  HWaddr 00:0C:29:0A:65:58 

          inet addr:192.168.111.30  Bcast:192.168.111.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe0a:6558/64 Scope:Link

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

          RX packets:166 errors:0 dropped:0 overruns:0 frame:0

          TX packets:28 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:15080 (14.7 KiB)  TX bytes:1700 (1.6 KiB)

 

bond1     Link encap:Ethernet  HWaddr 00:0C:29:0A:65:6C 

          inet addr:192.168.112.30  Bcast:192.168.112.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe0a:656c/64 Scope:Link

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1

          RX packets:2279 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1239 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:212658 (207.6 KiB)  TX bytes:142184 (138.8 KiB)

 

eth0      Link encap:Ethernet  HWaddr 00:0C:29:0A:65:58 

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:79 errors:0 dropped:0 overruns:0 frame:0

          TX packets:22 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:7291 (7.1 KiB)  TX bytes:1356 (1.3 KiB)

 

eth1      Link encap:Ethernet  HWaddr 00:0C:29:0A:65:58 

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:87 errors:0 dropped:0 overruns:0 frame:0

          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:7789 (7.6 KiB)  TX bytes:344 (344.0 b)

 

eth2      Link encap:Ethernet  HWaddr 00:0C:29:0A:65:6C 

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:2269 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1239 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:212058 (207.0 KiB)  TX bytes:142184 (138.8 KiB)

 

eth3      Link encap:Ethernet  HWaddr 00:0C:29:0A:65:6C 

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1

          RX packets:11 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:660 (660.0 b)  TX bytes:0 (0.0 b)

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:65536  Metric:1

          RX packets:30 errors:0 dropped:0 overruns:0 frame:0

          TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:2752 (2.6 KiB)  TX bytes:2752 (2.6 KiB)

         

重启服务器测试

重启后服务正常。

5,断网卡测试

[root@www.htz.pw bonding]# mii-tool eth0

eth0: no link

[root@www.htz.pw bonding]# mii-tool eth1

eth1: negotiated 100baseTx-FD, link ok

 

这里可以看到,已经自动切换到eth1上面

[root@www.htz.pw network-scripts]# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

 

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth1

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 5000

Down Delay (ms): 5000

 

Slave Interface: eth0

MII Status: down

Speed: Unknown

Duplex: Unknown

Link Failure Count: 1

Permanent HW addr: 00:0c:29:0a:65:58

Slave queue ID: 0

 

Slave Interface: eth1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 1

Permanent HW addr: 00:0c:29:0a:65:62

Slave queue ID: 0

本文固定链接: http://www.htz.pw/?p=907 | 认真就输

该日志由 huangtingzhong 于2015年03月20日发表在 LINUX 分类下, 通告目前不可用,你可以至底部留下评论。
原创文章转载请注明: RHEL 6.6 比网卡绑定测试 | 认真就输
关键字: ,