歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux系統雙網卡綁定單個IP地址[CentOS]

Linux系統雙網卡綁定單個IP地址[CentOS]

日期:2017/2/28 14:50:56   编辑:Linux教程

雙網卡綁定單個IP 地址為了提供網絡的高可用性,我們可能需要將多塊網卡綁定成一塊虛擬網卡對外提供服務,這樣即使其中的一塊物理網卡出現故障,也不會導致連接中斷。多網卡綁。

為了提供網絡的高可用性,我們可能需要將多塊網卡綁定成一塊虛擬網卡對外提供服務,這樣即使其中的一塊物理網卡出現故障,也不會導致連接中斷。在Linux下叫bonding,IBM稱為etherchanel,broadcom叫team,但是名字怎麼變,效果都是將兩塊或更多的網卡當做一塊網卡使用,在增加帶寬的同時也可以提高冗余性。比如我們在CentOS 6.3下可以將eth0和eth1綁定成虛擬網卡bond0。

如圖:

實驗配置:

mode=1:表示fault-tolerance (active-backup)提供冗余功能,工作方式是主備的工作方式,其中一塊網卡在工作(若eth0斷掉),則自動切換到另一個塊網卡(eth1做備份)。

系 統

設備名稱

IP地址

子網掩碼

CentOS 6.3_64bit

eth0

eth1

bond0

10.1.3.210

255.255.255.0

1、查看主機網卡

[root@web ~]# cd /etc/sysconfig/network-scripts/

[root@web1 network-scripts]# ll

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@web network-scripts]# cp ifcfg-eth0 ifcfg-bond0

[root@web 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@web network-scripts]# vim ifcfg-bond0

DEVICE=bond0

BOOTPROTO=static

IPADDR=10.1.3.210

NETMASK=255.255.255.0

GATEWAY=10.1.3.254

ONBOOT=yes

USERCTL=no



[root@web1 network-scripts]# vim ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no



[root@web1 network-scripts]# vim ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

USERCTL=no

Copyright © Linux教程網 All Rights Reserved