所谓多网卡冗余就是通过工具把多张网卡绑定成一个IP地址(bond0属于虚拟网卡)使用。这项技术在大中小企业都无比受用。如下图:
多网卡的绑定的优点:
1、扩大服务器的网络带宽
2、可以有效均衡负载和提高容错能力,避免单点失效
3、一旦发生故障,无缝切换网卡。
二、实现环境
虚拟机环境下加上本地的和添加的一共3张网卡分别是:eth0、eth1、eth2
IP:192.168.0.153/24
(同样物理机的不过是物理添加网卡,或者是多网卡服务器,一样可以作绑定)
三、搭建
首先大家可以看到主机上面的几张网卡,列出来
[root@linuxidc ~]# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:0C:29:1D:7A:25 inet addr:192.168.0.153 Bcast:192.168.3.255 Mask:255.255.252.0 inet6 addr: fe80::20c:29ff:fe1d:7a25/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:315026 errors:0 dropped:0 overruns:0 frame:0 TX packets:160536 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:313603361 (299.0 MiB) TX bytes:12994253 (12.3 MiB) eth1 Link encap:Ethernet HWaddr 00:0C:29:1D:7A:2F BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 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:0 (0.0 b) TX bytes:0 (0.0 b) eth2 Link encap:Ethernet HWaddr 00:0C:29:1D:7A:39 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 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:0 (0.0 b) TX bytes:0 (0.0 b) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@linuxidc ~]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:1d:7a:25 brd ff:ff:ff:ff:ff:ff inet 192.168.0.153/22 brd 192.168.3.255 scope global eth0 inet6 fe80::20c:29ff:fe1d:7a25/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:0c:29:1d:7a:2f brd ff:ff:ff:ff:ff:ff 4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000 link/ether 00:0c:29:1d:7a:39 brd ff:ff:ff:ff:ff:ff
下面我们把eth0-2都绑成bond0的虚拟网卡,先去修改eth0-2的网卡配置信息
[root@linuxidc network-scripts]# cd /etc/sysconfig/network-scripts
eth0-2: