主机有三网卡,其中两个是主板上的,一个是pci的网卡。作bonding的是主板上的那两个,命名为eth0和eth1,pci网卡是eth2。
动作分解:
1.增加alias,编辑/etc/modprobe.d/dist.conf,增加alias bond0 bonding
- echo "alias bond0 bonding" >> /etc/modprobe.d/dist.conf
2.创建网卡配置文件,如上,逻辑网卡的名称为bond0,对应的配置文件为 /etc/sysconfig/network-scripts/ifcfg-bond0
添加以下内容:
- DEVICE=bond0 //设备名称
- BOOTPROTO=static //通过静态获取IP,也可通过dhcp获取
- IPADDR=192.168.5.5 //静态IP
- NETMASK=255.255.255.0 //子网掩码
- GATEWAY=192.168.5.1 //网关
- ONBOOT=yes //启动设备
- BONDING_OPTS="mode=1 miimon=50"
3.配置物理网卡eth0和eth1
内容如下:
- DEVICE=eth0
- HWADDR=XX:XX:XX:XX:XX:XX //填上MAC也无碍,不然重启网卡eth号老是变化
- MASTER=bond0
- SLAVE=yes
- ONBOOT=yes
- DEVICE=eth1
- HWADDR=OO:OO:OO:OO:OO:OO
- MASTER=bond0
- SLAVE=yes
- ONBOOT=yes
4.重启网络。
- service network restart
就ok了。
想了解更详细的配置,可以参考
Linux系统的双网卡绑定:http://365linux.com/bonding.html
转载于:https://blog.51cto.com/hoenix/721008