導(dǎo)讀-- 本文首先探討了VLAN的一些局限性,接著闡述了PVLAN技術(shù)及其特點,最后詳細介紹了PVLAN的配置步驟,并給出了一個實例加以說明。
1 前言
交換機是網(wǎng)絡(luò)的核心設(shè)備之一,其技術(shù)發(fā)展非常迅速,從10Mbit/s以太網(wǎng)、100Mbit/s快速以太網(wǎng),進而發(fā)展到吉比特和10吉比特以太網(wǎng)。交換機在通信領(lǐng)域和企業(yè)中的應(yīng)用向縱深發(fā)展,網(wǎng)絡(luò)管理人員對掌握專用虛擬局域網(wǎng)PVLAN技術(shù)的需求也越來越迫切。本文通過實踐經(jīng)驗對這方面的應(yīng)用進行總結(jié)。
2 VLAN的局限性
隨著網(wǎng)絡(luò)的迅速發(fā)展,用戶對于網(wǎng)絡(luò)數(shù)據(jù)通信的安全性提出了更高的要求,諸如防范黑客攻擊、控制病毒傳播等,都要求保證網(wǎng)絡(luò)用戶通信的相對安全性;傳統(tǒng)的解決方法是給每個客戶分配一個VLAN和相關(guān)的IP子網(wǎng),通過使用VLAN,每個客戶被從第2層隔離開,可以防止任何惡意的行為和Ethernet的信息探聽。 然而,這種分配每個客戶單一VLAN和IP子網(wǎng)的模型造成了巨大的可擴展方面的局限。這些局限主要有下述幾方面。
(1)VLAN的限制:交換機固有的VLAN數(shù)目的限制;
(2)復(fù)雜的STP:對于每個VLAN,每個相關(guān)的Spanning Tree的拓撲都需要管理;
(3)IP地址的緊缺:IP子網(wǎng)的劃分勢必造成一些IP地址的浪費;
(4)路由的限制:每個子網(wǎng)都需要相應(yīng)的默認網(wǎng)關(guān)的配置。
3 PVLAN技術(shù)
現(xiàn)在有了一種新的VLAN機制,所有服務(wù)器在同一個子網(wǎng)中,但服務(wù)器只能與自己的默認網(wǎng)關(guān)通信。這一新的VLAN特性就是專用VLAN(Private VLAN)。在Private VLAN的概念中,交換機端口有三種類型:Isolated port,Community port, Promiscuous port;它們分別對應(yīng)不同的VLAN類型:Isolated port屬于Isolated PVLAN,Community port屬于Community PVLAN,而代表一個Private VLAN整體的是Primary VLAN,前面兩類VLAN需要和它綁定在一起,同時它還包括Promiscuous port。在Isolated PVLAN中,Isolated port只能和Promiscuous port通信,彼此不能交換流量;在Community PVLAN中,Community port不僅可以和Promiscuous port通信,而且彼此也可以交換流量。Promiscuous port 與路由器或第3層交換機接口相連,它收到的流量可以發(fā)往Isolated port和Community port。PVLAN的應(yīng)用對于保證接入網(wǎng)絡(luò)的數(shù)據(jù)通信的安全性是非常有效的,用戶只需與自己的默認網(wǎng)關(guān)連接,一個PVLAN不需要多個VLAN和IP子網(wǎng)就提供了具備第2層數(shù)據(jù)通信安全性的連接,所有的用戶都接入PVLAN,從而實現(xiàn)了所有用戶與默認網(wǎng)關(guān)的連接,而與PVLAN內(nèi)的其他用戶沒有任何訪問。PVLAN功能可以保證同一個VLAN中的各個端口相互之間不能通信,但可以穿過Trunk端口。這樣即使同一VLAN中的用戶,相互之間也不會受到廣播的影響。
4 PVLAN的配置步驟
(1)Put switch in VTP transparent mode
set vtp mode transparent
(2) Create the primary private VLAN
set vlan vlan pvlan-type primary
(3)Set the isolated or community VLAN(s)
set vlan vlan pvlan-type {isolated community}
(4)Map the secondary VLAN(s) to the primary VLAN
set pvlan primary_vlan {isolated_vlan community_
vlan} {mod/port sc0}
(5)Map each secondary VLAN to the primary VLAN on the promiscuous port(s)
set pvlan mapping primary_vlan {isolated_vlan community_vlan} {mod/port} [mod/port ...]
(6)Show PVLAN configuration
show pvlan [primary_vlan]
show pvlan mapping
show vlan [primary_vlan]
show port
5 例子
下面給出一個正在網(wǎng)絡(luò)中運行的交換機的PVLAN的相關(guān)配置,僅供參考。其中,VLAN 100是Primary VLAN,VLAN 101是Isolated VLAN,VLAN 102和VLAN 103是Community VLAN。
N8-CSSW-2> (enable) show running-config
This command shows non-default configurations only.
set system name N8-CSSW-2
#vtp
set vtp domain sdunicom
set vtp mode transparent
set vlan 1 name default type ethernet mtu 1500 said 100001 state active
set vlan 100 name VLAN0100 type ethernet pvlantype primary mtu 1500 said 100100 state active
set vlan 101 name VLAN0101 type ethernet pvlantype isolated mtu 1500 said 100101 state active
set vlan 102 name VLAN0102 type ethernet pvlantype community mtu 1500 said 100102 state active
set vlan 103 name VLAN0103 type ethernet pvlantype community mtu 1500 said 100103 state active
#module 2 : 50-port 10/100/1000 Ethernet
set pvlan 100 101 2/26-29,2/35-36,2/42-43
set pvlan mapping 100 101 2/49
set pvlan 100 102 2/1-13,2/30-34
set pvlan mapping 100 102 2/49
set pvlan 100 103 2/14-25
set pvlan mapping 100 103 2/49
end
N8-CSSW-2> (enable) show pvlan
Primary Secondary Secondary-Type Ports
------- --------- ----------------
100 101 isolated 2/26-29,2/35-36,2/42-43
100 102 community 2/1-13,2/30-34
100 103 community 2/14-25
6 結(jié)束語
目前很多廠商生產(chǎn)的交換機支持PVLAN技術(shù),PVLAN技術(shù)在解決通信安全、防止廣播風(fēng)暴和浪費IP地址方面的優(yōu)勢是顯而易見的,而且采用PVLAN技術(shù)有助于網(wǎng)絡(luò)的優(yōu)化,再加上PVLAN在交換機上的配置也相對簡單,PVLAN技術(shù)越來越得到網(wǎng)絡(luò)管理人員的青睞。