服务器虚拟交换机到网卡不通,浅析虚拟化环境网卡绑定模式
作者:郭國華,新炬網(wǎng)絡(luò)高級技術(shù)專家。
隨著云計算的發(fā)展,虛擬化技術(shù)已普遍應用于各類型企業(yè),同時虛擬化為服務器帶來密集的網(wǎng)絡(luò)吞吐壓力已成為影響云計算發(fā)展的最大性能瓶頸之一,為了最大化提升主機網(wǎng)絡(luò)性能,對不同的業(yè)務場景主機需配置合理的網(wǎng)卡BOND模式,本項目將在不對交換機做特別設(shè)置的KVM虛擬化環(huán)境下(交換機采用Trunk模式)對七種雙網(wǎng)卡BOND模式進行測試,用數(shù)據(jù)說話淺析虛擬化環(huán)境網(wǎng)卡綁定模式應該如何選擇。
一、測試環(huán)境方法介紹
(一)網(wǎng)絡(luò)拓撲圖
(二)測試環(huán)境及工具:
本項目使用2臺服務器(各跑一臺虛擬機)、3臺交換機KVM虛擬化環(huán)境進行測試,測試軟硬件環(huán)境及工具如下:
1、 服務器:2臺IBM X3950M2服務器(帶2張千兆網(wǎng)卡),2臺虛擬機;
2、 交換機:1臺Cisco Nexus 5548P,2臺Cisco Nexus 2248TP,Trunk模式;
3、 操作系統(tǒng):linux redhat6.2,KVM虛擬化、網(wǎng)卡橋接模式(見上圖);
4、 測試工具:netperf、ping、scp、sar、iostat。
(三)具體測試項
擬定BOND模式的測試項目如下:
1、 丟包率測試:通過ping命令測試主機間網(wǎng)絡(luò)丟包情況;
2、 網(wǎng)卡切換效率測試:通過down、up網(wǎng)卡測試切換過程ping與文件傳輸?shù)闹袛嗲闆r;
3、 網(wǎng)絡(luò)TCP、UDP吞吐量:通過netperf命令分別測試TCP與UDP的吞吐量;
4、 網(wǎng)絡(luò)速率測試:通過網(wǎng)絡(luò)傳輸文件測試網(wǎng)絡(luò)接收、發(fā)送速率。
二、七種網(wǎng)卡綁定模式介紹
網(wǎng)卡綁定7種模式官方說明如下,網(wǎng)上一堆資料在此不再贅述:
mode=0 (balance-rr)
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
mode=1 (active-backup)
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.
mode=2 (balance-xor)
XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
mode=3 (broadcast)
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
mode=4 (802.3ad)
IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
Pre-requisites: 1. Ethtool support in the base drivers for retrieving the speed and duplex of each slave. 2. A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.
mode=5 (balance-tlb)
Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.
mode=6 (balance-alb)
Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.
三、測試結(jié)果
通過測試發(fā)現(xiàn)只有3種模式適用于該虛擬化環(huán)境的虛擬機通訊需求,詳見下表:
四、關(guān)鍵問題分析
也許大家比較疑惑“mod=0,mod=3、mod=4”大多需要交換機支持在該環(huán)境不適用還算正常,但“mod=6”是常用的負載均衡模式為什么不適用呢?通過分析情況如下:
(一)mod=6虛擬機ping丟包大于90%
mod=6模式:交換機ACCESS模式物理機通訊正常,交換機trunk模式虛擬機能ping通網(wǎng)關(guān),虛擬機之間互ping斷斷續(xù)續(xù)的能ping通幾個包丟包率達90%,原因:N5K學習到虛擬機的MAC地址不對(為物理機MAC地址),故虛擬機之間ping不通;路由端學習到虛擬機的MAC地址正確故虛擬機ping網(wǎng)關(guān)正常。
(二)mod=6另一個需要關(guān)注問題
mod=6,該模式有一個需要特別關(guān)注的問題,當一個網(wǎng)卡狀態(tài)不穩(wěn)定(時down時up)的時候,網(wǎng)絡(luò)切換平衡過程將會頻繁進入混雜模式導致網(wǎng)絡(luò)不通,臨時解決辦法為down掉異常的網(wǎng)卡,在運維過程中應該加強網(wǎng)卡狀態(tài)的監(jiān)控。注:網(wǎng)卡損壞的情況下可正常切換不影響網(wǎng)絡(luò)通訊。
五、模式選擇建議
通過對測試結(jié)果的總結(jié)分析發(fā)現(xiàn),僅有3種模式(mod=1,mod=2,mod=5)適用于KVM虛擬化多網(wǎng)絡(luò)隔離的模式(交換機Trunk模式),3種模式的優(yōu)缺點如下:
(一)mod=1
即: (active-backup) Active-backup policy(主-備份策略)
特點:只有一個設(shè)備處于活動狀態(tài),當一個宕掉另一個馬上由備份轉(zhuǎn)換為主設(shè)備;此模式只提供了容錯能力,ping無丟包,網(wǎng)卡切換過程ping無中斷、文件傳輸無中斷;文件傳輸過程網(wǎng)絡(luò)接收、發(fā)送速率均處于較穩(wěn)定狀態(tài)(約100MB/S),整個測試過程主機網(wǎng)絡(luò)均處于較穩(wěn)定的狀態(tài),業(yè)界大多虛擬化環(huán)境采用該模式穩(wěn)定及高可用性已得到了充分的證明。
(二)mod=2
即:(balance-xor) XOR policy(平衡策略)
特點:基于指定的傳輸HASH策略傳輸數(shù)據(jù)包;此模式提供負載平衡和容錯能力,ping無丟包(丟失會重復ping);網(wǎng)卡切換過程ping中斷1-2秒(網(wǎng)卡重新up過程ping不穩(wěn)定)、文件傳輸無中斷,文件傳輸過程網(wǎng)絡(luò)接收、發(fā)送速率提升約90%(約190MB/S)。另:因采用本機地址與目的地址XOR決定傳輸路徑,通過網(wǎng)關(guān)(每次XOR的地址一樣)的傳輸固定在一條路徑,故跨網(wǎng)段未能實現(xiàn)負載平衡。網(wǎng)上眾多資料顯示該模式需要交換機支持(端口配置“port?channel”),實際測試并非如此,故技術(shù)是實踐出來的使用前做好詳細測試不要盲從。
(三)mod=5,
即:(balance-tlb) Adaptive transmit load balancing(適配器傳輸負載均衡)
特點:不需要任何特別的switch(交換機)支持的通道bonding。在每個slave上根據(jù)當前的負載(根據(jù)速度計算)分配外出流量。此模式提供外出流量負載平衡與容錯能力,ping無丟包;網(wǎng)卡切換過程ping無中斷(同模式間up網(wǎng)卡時ping斷約5秒)、文件傳輸無中斷;文件傳輸過程網(wǎng)絡(luò)接收速率未實現(xiàn)負載平衡(約110MB/S)、網(wǎng)絡(luò)發(fā)送速率實現(xiàn)負載平衡約提升50%(約160MB/S)。該模式與前面2種比較穩(wěn)定性稍差,且只提供了單向負載均衡同時速率提升不明顯,不建議使用。
選擇建議:
mod=1模式的穩(wěn)定性、高可用性已久經(jīng)考驗,如無特殊需求則是虛擬化環(huán)境網(wǎng)卡模式的首選;如對虛擬機之間的傳輸帶寬有較大的需求,可對mod=2的模式進行詳細測試后選擇使用;如前2種模式均無法滿足需求再考慮通過修改交換機配置選擇其它的模式,因為云計算的網(wǎng)絡(luò)環(huán)境通常比較復雜,牽一發(fā)而動全身請慎重使用。
總結(jié)
以上是生活随笔為你收集整理的服务器虚拟交换机到网卡不通,浅析虚拟化环境网卡绑定模式的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 中兴存储服务器 操作系统,中兴新支点服务
- 下一篇: mc服务器音乐文件夹在哪,添加自定义音乐