1.编辑虚拟网络接口配置文件,指定网卡IP vi /etc/sysconfig/ network-scripts/ ifcfg-bond0 [root@rhas-13 root]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-bond0 2 #vi ifcfg-bond0 将第一行改成 DEVICE=bond0 # cat ifcfg-bond0 DEVICE=bond0 BOOTPROTO=STATIC IPADDR=172.31.0.13 NETMASK=255.255.252.0 BROADCAST=172.31.3.254 ONBOOT=yes TYPE=Ethernet 这里要主意,不要指定单个网卡的IP 地址、子网掩码或网卡 ID。将上述信息指定到虚拟适配器(bonding)中即可。 [root@rhas-13 network-scripts]# cat ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=DHCP [root@rhas-13 network-scripts]# cat ifcfg-eth1 DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp
3 # vi /etc/modprope.conf 编辑 /etc/modules.conf 文件,加入如下一行内容,以使系统在启动时加载bonding模块,对外虚拟网络接口设备为 bond0 加入下列两行 alias bond0 bonding options bond0 miimon=100 mode=1 说明:miimon是用来进行链路监测的。 比如:miimon=100,那么系统每100ms监测一次链路连接状态,如果有一条线路不通就转入另一条线路;mode的值表示工作模式,他共有0,1,2,3四种模式,常用的为0,1两种。 mode=0表示load balancing (round-robin)为负载均衡方式,两块网卡都工作。 mode=1表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,也就是说默认情况下只有一块网卡工作,另一块做备份. bonding只能提供链路监测,即从主机到交换机的链路是否接通。如果只是交换机对外的链路down掉了,而交换机本身并没有故障,那么bonding会认为链路没有问题而继续使用 4 # vi /etc/rc.d/rc.local 加入两行 ifenslave bond0 eth0 eth1 route add -net 172.31.3.254 netmask 255.255.255.0 bond0
到这时已经配置完毕重新启动机器. 重启会看见以下信息就表示配置成功了 ................ Bringing up interface bond0 OK Bringing up interface eth0 OK Bringing up interface eth1 OK
浙公网安备 33010602011771号