linux双网卡冗余(bonding)

指导:kevin

 

1、# vi /etc/modprobe.conf
在最后添加如下两行
alias bond0 bonding
options bonding miimon=100 mode=1

2、# cd /etc/sysconfig/network-scripts/
   # vi ifcfg-eth0
把第一块网卡配置文件修改为类似如下

  
  
  
  
  1. # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)  
  2. DEVICE=eth0 
  3. USERCTL=no 
  4. BOOTPROTO=none 
  5. ONBOOT=yes 
  6. MASTER=bond0 
  7. SLAVE=yes 

  # cat ifcfg-eth1
第二块如下

  
  
  
  
  1. # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)  
  2. DEVICE=eth1 
  3. USERCTL=no 
  4. BOOTPROTO=none 
  5. ONBOOT=yes 
  6. MASTER=bond0 
  7. SLAVE=yes 

3、创建bonding配置文件
# cat /etc/sysconfig/network-scripts/ifcfg-bond0

  
  
  
  
  1. DEVICE=bond0 
  2. USERCTL=no 
  3. ONBOOT=yes 
  4. BROADCAST=192.168.0.255  
  5. NETWORK=192.168.0.0  
  6. NETMASK=255.255.255.0  
  7. GATEWAY=192.168.0.2  
  8. IPADDR=192.168.0.202  
  9. BONDING_MASTER=yes   

4、重启系统生效,或执行如下命令

  
  
  
  
  1. # insmod /lib/modules/`uname -r`/kernel/drivers/net/bonding/bonding.o miimon=100 mode=1 
  2. # service network restart  

5、查看
# ifconfig
bond0     Link encap:Ethernet  HWaddr 00:0C:29:25:CD:F4 
          inet addr:192.168.0.202  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe25:cdf4/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:311 errors:0 dropped:0 overruns:0 frame:0
          TX packets:180 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:26056 (25.4 KiB)  TX bytes:20614 (20.1 KiB)

eth0      Link encap:Ethernet  HWaddr 00:0C:29:25:CD:F4 
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:265 errors:0 dropped:0 overruns:0 frame:0
          TX packets:189 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:23296 (22.7 KiB)  TX bytes:22016 (21.5 KiB)
          Base address:0x2000 Memory:d8940000-d8960000

eth1      Link encap:Ethernet  HWaddr 00:0C:29:25:CD:F4 
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:51 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:3060 (2.9 KiB)  TX bytes:0 (0.0 b)
          Base address:0x2040 Memory:d8960000-d8980000

你可能感兴趣的:(linux,冗余,双网卡,休闲,bonding)