主机有三网卡,其中两个是主板上的,一个是pci的网卡。作bonding的是主板上的那两个,命名为eth0和eth1,pci网卡是eth2。

动作分解:

1.增加alias,编辑/etc/modprobe.d/dist.conf,增加alias bond0 bonding

 
  
  1. echo "alias bond0 bonding" >> /etc/modprobe.d/dist.conf 

2.创建网卡配置文件,如上,逻辑网卡的名称为bond0,对应的配置文件为 /etc/sysconfig/network-scripts/ifcfg-bond0

添加以下内容:

 
  
  1. DEVICE=bond0  //设备名称 
  2. BOOTPROTO=static  //通过静态获取IP,也可通过dhcp获取 
  3. IPADDR=192.168.5.5  //静态IP 
  4. NETMASK=255.255.255.0  //子网掩码 
  5. GATEWAY=192.168.5.1  //网关 
  6. ONBOOT=yes  //启动设备 
  7. BONDING_OPTS="mode=1 miimon=50" 

3.配置物理网卡eth0和eth1

内容如下:

 
  
  1. DEVICE=eth0 
  2. HWADDR=XX:XX:XX:XX:XX:XX   //填上MAC也无碍,不然重启网卡eth号老是变化  
  3. MASTER=bond0  
  4. SLAVE=yes  
  5. ONBOOT=yes 

 
  
  1. DEVICE=eth1 
  2. HWADDR=OO:OO:OO:OO:OO:OO 
  3. MASTER=bond0 
  4. SLAVE=yes 
  5. ONBOOT=yes 

4.重启网络。

 
  
  1. service network restart 

就ok了。

想了解更详细的配置,可以参考

Linux系统的双网卡绑定:http://365linux.com/bonding.html