`

RHEL 5双网卡配置

阅读更多

1、vi /etc/modprobe.conf,在末尾增加两行
    alias bond0 bonding
    options bond0 miimon=100 mode=1

2、cd /etc/sysconfig/network-script

    1)新建文件 ifcfg-bond0,内容如下:
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.0.104 (据实修改)
NETMASK=255.255.255.0 (据实修改)
NETWORK=192.168.0.0 (据实修改)
USERCTL=no
IPV6INIT=no
GATEWAY=192.168.0.1 (据实修改)

    2)vi ifcfg-eth0, (原文件请备份到其他目录),内容如下
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes

    3)vi ifcfg-eth1, (原文件请备份到其他目录),内容如下
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes

3、重启网络服务或重启机器,推荐后者
    1)重启网络服务
        service network restart

    2)重启机器
        shutdown -r now

4、检查网络状态,ifconfig -a,显示类似如下:
[root@SCKF-WEB2 etc]# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:1B:78:BE:5D:02 (MAC地址默认使用eth0的)
          inet addr:192.168.0.104 Bcast:192.168.0.255 Mask:255.255.255.0
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 (重点看关键字 RUNNING MASTER )
          RX packets:2911 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2699 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:289847 (283.0 KiB) TX bytes:1103452 (1.0 MiB)

eth0 Link encap:Ethernet HWaddr 00:1B:78:BE:5D:02
          inet6 addr: fe80::21b:78ff:febe:5d02/64 Scope:Link
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 (重点看关键字 RUNNING SLAVE )
          RX packets:2821 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2697 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:284039 (277.3 KiB) TX bytes:1103304 (1.0 MiB)
          Interrupt:5 Memory:fa000000-fa011100

eth1 Link encap:Ethernet HWaddr 00:1B:78:BE:5D:02
          inet6 addr: fe80::21b:78ff:febe:5d02/64 Scope:Link
          UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 (重点看关键字 RUNNING SLAVE )
          RX packets:90 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5808 (5.6 KiB) TX bytes:148 (148.0 b)
          Interrupt:7 Memory:f8000000-f8011100

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:16436 Metric:1
          RX packets:3256 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3256 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4234397 (4.0 MiB) TX bytes:4234397 (4.0 MiB)

sit0 Link encap:IPv6-in-IPv4
          NOARP MTU:1480 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

5、上述配置是双网卡以主备模式工作,默认eth0为主卡,一旦eth0状态为down,则eth1在1、2百毫秒时间内可以接替工作。现场已经拔插网线验证属实。几乎感觉不到网络的中断。

官方的资料请参考 /usr/share/doc/iputils-20020927/README.bonding

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics