標籤:linux vlan tag trunk centos trunk centos vlan tag cisco ucs manager
最近新進了一批Cisco UCS C系列伺服器,經過兩周的部署安裝終於可以進行測試了。本文簡要介紹一下cisco UCS伺服器中作業系統(CentOS 6)的網路設定。可以簡單的認為,本文描述的是一台物理伺服器用網線將網卡串連到上層交換器的trunk模式的連接埠中的網路設定。
物理串連拓撲圖如下所示。
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="image" src="http://img1.51cto.com/attachment/201407/24/1539422_14061938769HNZ.png" height="330" />
頂層採用Cisco C3560物理交換器,為整個機群提供Internet串連。Vlan劃分為兩個,一個管理Vlan一個應用Vlan,Vlan ID分別為4和31,上聯連接埠全部設定為trunk模式。
兩台互聯矩陣(Fabric Interconnect)以叢集的形式將6台UCS伺服器串連在一起,降低了網路複雜性和提高了伺服器管理能力和大規模擴充性。每一台UCS機架伺服器裝有一塊VIF介面卡,提供兩個千兆乙太網路介面,利用Cisco網路虛擬化技術同時提供管理網路介面和作業系統網路介面。
其中FI是版本較老的6120和新伺服器的版本不一致,因此還需將版本全部設定為最新版本,如將FI升級到2.2(11d)版本,這樣才能通過FI管理這些UCS C Rackmount Server。
在Cisco UCS Manager中,為每一個伺服器虛擬出4塊網卡,第一塊網卡用作管理網路介面,用於遠端管理。在配置的過程中將這四塊虛擬網卡全部設定為“trunk模式”,可以處理兩個Vlan(Vlan 4、31)和native Vlan(Vlan1)的流量(此處本應該設定為“access模式”,正由於是trunk模式,才有了下文)。如果不給網卡加Vlan tag標記的話,作業系統網路就不通,這與上遊交換器與下遊交換器串連有差別(下遊交換器可以手動設定或自動協商),如可簡單理解成如下串連模式,如所示。
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="image" src="http://img1.51cto.com/attachment/201407/24/1539422_1406193877u2dR.png" height="419" />
由於不是access模式,因此在作業系統中必須統一Vlan“馬甲”,將Vlan ID打給網卡上。具體流程如下:
1.由於是迷你安裝的,本身又沒有連網,因此必須掛載CentOS DVD iso到伺服器上,可藉助KVM的虛擬光碟機遠程掛載,一般的,在CentOS中,cdrom編號為1,即/dev/cdrom1,使用mount /dev/cdrom1 /mnt,可以通過命令完成提示判斷,如果提示執行裝置檔案系統類型的話就是錯誤的編號。
650) this.width=650;" title="image" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="image" src="http://img1.51cto.com/attachment/201407/24/1539422_1406193877fzLu.png" height="634" />
2.通過rpm命令安裝vconfig(VLAN (802.1q) 配置程式)來處理Vlan tag,rpm –ivh /mnt/Packages/vconfig-1.9-8.1.el6.x86_64.rpm,具體參考下面圖示。
3.在安裝vconfig前8021q模組就已經存在了,預設不會載入到核心中,執行vconfig命令時會自動添加到核心模組中。可以採用modprobe命令將8021q模組添加到核心中,modprobe 8021q,添加成功後無任何提示資訊並自動結束,可用lsmod命令列出8021q模組驗證添加成功與否,lsmod | grep 8021q,具體參考下面圖示。
4.利用vconfig給網卡添加Vlan tag,命令為vconfig add eth0 4,eth0表示欲使用的網卡,4表示Vlan id,成功後會提示eth0已經添加Vlan id xx,具體參考下面圖示。
650) this.width=650;" title="2014-07-24_160100" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="2014-07-24_160100" src="http://img1.51cto.com/attachment/201407/24/1539422_14061938772hy3.jpg" height="633" />
5.複製ifcfg-eth0到ifcfg-eth0.4,注意eth0是必須啟用的,但不需要填寫IP地址,就像交換器一樣。關鍵點:將ONBOOT設定為yes,將BOOTPROTO設定為none。
650) this.width=650;" title="2014-07-24_160144" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="2014-07-24_160144" src="http://img1.51cto.com/attachment/201407/24/1539422_1406193878I2zC.jpg" height="634" />
6.編輯ifcfg-eth0.4檔案,將ONBOOT設定為yes,將BOOTPROTO設定為static或dhcp,就像配置普通的網卡一樣進行配置,配置結束後重啟網路,利用ping檢查網路是否暢通。
650) this.width=650;" title="2014-07-24_160212" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="2014-07-24_160212" src="http://img1.51cto.com/attachment/201407/24/1539422_1406193878Cvph.jpg" height="636" />
650) this.width=650;" title="2014-07-24_160339" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="2014-07-24_160339" src="http://img1.51cto.com/attachment/201407/24/1539422_1406193878Oxk4.jpg" height="638" />
650) this.width=650;" title="2014-07-24_160405" style="border-top:0px;border-right:0px;border-bottom:0px;border-left:0px;" border="0" alt="2014-07-24_160405" src="http://img1.51cto.com/attachment/201407/24/1539422_14061938799r4F.jpg" height="639" />
end
本文出自 “通訊,我的最愛” 部落格,請務必保留此出處http://dgd2010.blog.51cto.com/1539422/1529770