基於centos6.8配置多網路卡繫結
Linux 自帶的軟體bonding 可以把多個網路介面裝置捆綁為單個的網路介面設定來使用,用於網路負載均衡及網路冗餘。其中網路負載均衡常用於我們的檔案伺服器中,檔案伺服器在多使用者同時使用的情況下,網路壓力非常大的,所以為了解決同一個IP突破流量的限制,使用多網路卡繫結是一個極好的辦法。網路冗餘在生產環境中也特別重要,特別是在網路卡在可能發生物理性質損壞而無法同時使用同一IP快速響應的情況下多網路卡繫結就顯得特別重要了,bonding為網路卡提供了冗餘的支援,把多網路卡繫結到一個IP,即使其中一塊網路卡發生物理損壞的情況下,另一塊網路卡自動啟用,並且提供正常服務。
下面我們先來了解一下bonding的常用mode種類:
mode=0 ,即:(balance-rr) Round-robin policy(平衡掄迴圈策略)資料包的傳輸方式輪詢傳輸,第一個包傳輸給eth0 ,第二個包傳輸給eth1,就這樣迴圈下去,直到傳輸完畢,這裡需要注意的是mode0能作為負載均衡作用,不提供容錯功能,如果第一張網路卡出現故障網路將面臨癱瘓。
mode=1,即: (active-backup) Active-backup policy(主-備份策略)只有一個處於活動狀態,當主網路卡出現故障時,備網路卡馬上由備轉變成主。這個模式提供了較高的容錯能力。但是資源利用率較低。
mode=3,即:broadcast(廣播策略)在每個slave介面上傳輸每個資料包,此模式提供了容錯能力
演示環境:VMware 11 版本 ,系統centos 6.8
第一步:
首先我們新新增一張網路卡,重啟並生效
第二步:關閉NetworkManager服務(在centos6系列版本中開啟NetworkManager與bonding會產生衝突)
[root@centos6 ~]# service NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[root@centos6 ~]# chkconfig NetworkManager off
第三步:建立虛擬網路卡bond0,在/etc/sysconfig/network-scripts目錄下新建虛擬網路卡band0,在這裡使用的mode是1,檔案內容如圖所示
[root@centos6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
BONDING_OPTS="miimon=100,mode=1"
IPADDR=10.1.45.181
PREFIX=16
GATEWAY=10.1.0.1
第四步:配置網路卡引數,網路卡引數中需要標註網路卡名,網路卡的角色及虛擬主卡名稱。
[root@centos6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
SLAVE=yes
MASTER=bond0
[root@centos6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
SLAVE=yes
MASTER=bond0
第五步:重啟網路卡,檢視狀態
使用我另一臺主機ping狀態為通
Connecting to 10.1.45.180:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Thu Sep 1 14:51:24 2016 from 10.1.250.31
Welcome to the home of snowbamboo ^ ^
[root@localhost ~]# ping 10.1.45.181
PING 10.1.45.181 (10.1.45.181) 56(84) bytes of data.
64 bytes from 10.1.45.181: icmp_seq=1 ttl=64 time=1.63 ms
64 bytes from 10.1.45.181: icmp_seq=2 ttl=64 time=0.354 ms
64 bytes from 10.1.45.181: icmp_seq=3 ttl=64 time=0.250 ms
64 bytes from 10.1.45.181: icmp_seq=4 ttl=64 time=0.514 ms
64 bytes from 10.1.45.181: icmp_seq=5 ttl=64 time=0.282 ms
64 bytes from 10.1.45.181: icmp_seq=6 ttl=64 time=0.252 ms
64 bytes from 10.1.45.181: icmp_seq=7 ttl=64 time=0.361 ms
64 bytes from 10.1.45.181: icmp_seq=8 ttl=64 time=0.310 ms
64 bytes from 10.1.45.181: icmp_seq=9 ttl=64 time=0.426 ms
64 bytes from 10.1.45.181: icmp_seq=10 ttl=64 time=0.439 ms
64 bytes from 10.1.45.181: icmp_seq=11 ttl=64 time=0.506 ms
64 bytes from 10.1.45.181: icmp_seq=12 ttl=64 time=0.502 ms
64 bytes from 10.1.45.181: icmp_seq=13 ttl=64 time=0.423 ms
64 bytes from 10.1.45.181: icmp_seq=14 ttl=64 time=0.230 ms
64 bytes from 10.1.45.181: icmp_seq=15 ttl=64 time=0.494 ms
64 bytes from 10.1.45.181: icmp_seq=16 ttl=64 time=0.417 ms
64 bytes from 10.1.45.181: icmp_seq=17 ttl=64 time=0.522 ms
現在我關閉一張網路卡,看網路是否有波動
總結:
在使用bonding的mode1時,必須至少要有兩塊網路卡,一張為活動網路卡,另一張為備用狀態,當主卡發生故障時備卡馬上接替工作,繼續完成資料傳輸。mode0模式時需要注意的是,mode0只支援負載均衡,加速網路資料包傳輸,沒有容錯功能。
下面我們先來了解一下bonding的常用mode種類:
mode=0 ,即:(balance-rr) Round-robin policy(平衡掄迴圈策略)資料包的傳輸方式輪詢傳輸,第一個包傳輸給eth0 ,第二個包傳輸給eth1,就這樣迴圈下去,直到傳輸完畢,這裡需要注意的是mode0能作為負載均衡作用,不提供容錯功能,如果第一張網路卡出現故障網路將面臨癱瘓。
mode=1,即: (active-backup) Active-backup policy(主-備份策略)只有一個處於活動狀態,當主網路卡出現故障時,備網路卡馬上由備轉變成主。這個模式提供了較高的容錯能力。但是資源利用率較低。
mode=3,即:broadcast(廣播策略)在每個slave介面上傳輸每個資料包,此模式提供了容錯能力
演示環境:VMware 11 版本 ,系統centos 6.8
第一步:
首先我們新新增一張網路卡,重啟並生效
第二步:關閉NetworkManager服務(在centos6系列版本中開啟NetworkManager與bonding會產生衝突)
[root@centos6 ~]# service NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[root@centos6 ~]# chkconfig NetworkManager off
第三步:建立虛擬網路卡bond0,在/etc/sysconfig/network-scripts目錄下新建虛擬網路卡band0,在這裡使用的mode是1,檔案內容如圖所示
[root@centos6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
BONDING_OPTS="miimon=100,mode=1"
IPADDR=10.1.45.181
PREFIX=16
GATEWAY=10.1.0.1
第四步:配置網路卡引數,網路卡引數中需要標註網路卡名,網路卡的角色及虛擬主卡名稱。
[root@centos6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
SLAVE=yes
MASTER=bond0
[root@centos6 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
SLAVE=yes
MASTER=bond0
第五步:重啟網路卡,檢視狀態
使用我另一臺主機ping狀態為通
Connecting to 10.1.45.180:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Thu Sep 1 14:51:24 2016 from 10.1.250.31
Welcome to the home of snowbamboo ^ ^
[root@localhost ~]# ping 10.1.45.181
PING 10.1.45.181 (10.1.45.181) 56(84) bytes of data.
64 bytes from 10.1.45.181: icmp_seq=1 ttl=64 time=1.63 ms
64 bytes from 10.1.45.181: icmp_seq=2 ttl=64 time=0.354 ms
64 bytes from 10.1.45.181: icmp_seq=3 ttl=64 time=0.250 ms
64 bytes from 10.1.45.181: icmp_seq=4 ttl=64 time=0.514 ms
64 bytes from 10.1.45.181: icmp_seq=5 ttl=64 time=0.282 ms
64 bytes from 10.1.45.181: icmp_seq=6 ttl=64 time=0.252 ms
64 bytes from 10.1.45.181: icmp_seq=7 ttl=64 time=0.361 ms
64 bytes from 10.1.45.181: icmp_seq=8 ttl=64 time=0.310 ms
64 bytes from 10.1.45.181: icmp_seq=9 ttl=64 time=0.426 ms
64 bytes from 10.1.45.181: icmp_seq=10 ttl=64 time=0.439 ms
64 bytes from 10.1.45.181: icmp_seq=11 ttl=64 time=0.506 ms
64 bytes from 10.1.45.181: icmp_seq=12 ttl=64 time=0.502 ms
64 bytes from 10.1.45.181: icmp_seq=13 ttl=64 time=0.423 ms
64 bytes from 10.1.45.181: icmp_seq=14 ttl=64 time=0.230 ms
64 bytes from 10.1.45.181: icmp_seq=15 ttl=64 time=0.494 ms
64 bytes from 10.1.45.181: icmp_seq=16 ttl=64 time=0.417 ms
64 bytes from 10.1.45.181: icmp_seq=17 ttl=64 time=0.522 ms
現在我關閉一張網路卡,看網路是否有波動
總結:
在使用bonding的mode1時,必須至少要有兩塊網路卡,一張為活動網路卡,另一張為備用狀態,當主卡發生故障時備卡馬上接替工作,繼續完成資料傳輸。mode0模式時需要注意的是,mode0只支援負載均衡,加速網路資料包傳輸,沒有容錯功能。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-2135955/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 5.4上雙網路卡(多網路卡)繫結CentOS
- 基於nodejs的阿里雲DDNS服務,支援多網路卡繫結NodeJS阿里DNS
- 關於AIX雙網路卡繫結AI
- Solaris下網路卡繫結多個IP
- RHEL5.6 多網路卡bond 繫結
- Linux單網路卡繫結多IP與多網路卡共用單IPLinux
- Redhat Linux網路卡配置與繫結RedhatLinux
- Redhat Linux網路卡配置與繫結(zt)RedhatLinux
- Liunx 網路卡繫結
- 雙網路卡繫結
- 多塊網路卡繫結IP在linux下Linux
- Windows下單網路卡繫結多個IP地址Windows
- Oracle 11gR2 RAC 單網路卡轉雙網路卡繫結配置Oracle
- Linux網路卡繫結Linux
- 剖析網路卡繫結模式模式
- linux 網路卡繫結Linux
- 在 Linux 中用 nmcli 命令繫結多塊網路卡Linux
- (轉)linux 實現多網路卡繫結BondingLinux
- Linux(09):網路卡繫結Linux
- linux雙網路卡繫結Linux
- Oracle RAC 與 網路卡繫結Oracle
- redhat 6.3 雙網路卡繫結Redhat
- Linux 繫結雙網路卡Linux
- Linux 雙網路卡繫結Linux
- Redhat AS 5.4 雙網路卡繫結Redhat
- 網路卡繫結七種模式模式
- centos 6.5 雙網路卡繫結CentOS
- linux rac 網路卡繫結Linux
- 【轉】redhat 雙網路卡繫結Redhat
- liunx下雙網路卡繫結
- SCO一個網路卡上面繫結多個IP地址(轉)
- [Linux] Linux bond 網路卡繫結配置教程(轉載)Linux
- 網路卡繫結與交換機埠聚合配置(CentOS6.2)CentOS
- linux6.5 網路卡繫結Linux
- RHEL6 雙網路卡繫結
- linux redhat 雙網路卡繫結LinuxRedhat
- NIC bonding 雙網路卡繫結
- Linux下雙網路卡繫結bond配置例項詳解Linux