Linux双网卡绑定 下载本文

RH_Linux6版本多网卡绑定一个IP地址配置

双网卡绑定单个IP地址为了提供网络的高可用性,我们可能需要将多块网卡绑定成一块虚拟网卡对外提供服务,这样即使其中的一块物理网卡出现故障,也不会导致连接中断。多网卡绑。

为了提供网络的高可用性,我们可能需要将多块网卡绑定成一块虚拟网卡对外提供服务,这样即使其中的一块物理网卡出现故障,也不会导致连接中断。在Linux下叫bonding,IBM称为etherchanel,broadcom叫team,但是名字怎么变,效果都是将两块或更多的网卡当做一块网卡使用,在增加带宽的同时也可以提高冗余性。比如我们在CentOS 6.3下可以将eth0和eth1绑定成虚拟网卡bond0。 注意:Linux6.0以上配置双网卡绑定需关闭NetworkManager服务: 关闭方法:

service NetworkManager stop --停止NetworkManger服务。 chkconfigNetworkManager off --关闭开机启动NetworkManger服务。

如图: mode=1:表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,其中一块网卡在工作(若eth0断掉),则自动切换到另一个块网卡(eth1做备份)。 mode=0:表示负载均衡。 系 统 Linux 6.3 设备名称 eth0 eth1 bond0 IP地址 子网掩码 192.168.1.105 255.255.255.0 1、查看主机网卡

[root@nmsapp ~]# cd /etc/sysconfig/network-scripts/ [root@nmsapp network-scripts]# ls total 200

-rw-r--r--. 1 root root 212 Mar 20 22:15 ifcfg-eth0

-rw-r--r-- 1 root root 212 Mar 23 19:10 ifcfg-eth1

2、复制ifcfg-bond0

[root@nmsapp network-scripts]# cp ifcfg-eth0 ifcfg-bond0 [root@nmsapp network-scripts]# ll total 204

-rw-r--r-- 1 root root 212 Mar 23 19:12 ifcfg-bond0 -rw-r--r--. 1 root root 212 Mar 20 22:15 ifcfg-eth0 -rw-r--r-- 1 root root 212 Mar 23 19:10 ifcfg-eth1

3、编辑ifcfg-bond0、ifcfg-eth0、ifcfg-eth1

[root@nmsapp network-scripts]# vi ifcfg-bond0 DEVICE=bond0 BOOTPROTO=static IPADDR=192.168.1.105 NETMASK=255.255.255.0 NETWORK=192.168.1.0 GATEWAY=192.168.1.1 TYPE=Ethernet ONBOOT=yes USERCTL=no