private vlan 的配置

本文章代碼轉自:http://bbs.51cto.com/thread-938135-1.html

 

 

 

private vlan:

private vlan是一個私有vlan,配置之後可以實現同一vlan的主機之間實現隔離,加強了網絡安全。

private vlan包括三部分,分別是:primary vlan、isolated vlan、community vlan。primary vlan是一個整體vlan,各部分的主機都能和這部分的主機通信;isolated vlan是一個隔離vlan,isolated vlan中的用戶之間不能相互通信,isolated vlan中的用戶只能和primary vlan中的用戶通信;相同community vlan中的主機相互之間能夠通信,不同community vlan之間的用戶不能通信,community vlan中的用戶可以和primary vlan中的用戶通信,一個vlan中至少有isolated vlan和community vlan的和至少是一個,同時一個vlan中最多有一個isolated vlan。在對外表現時,這個vlan表現的是primary vlan的id號碼和信息,isolated vlan和community vlan的信息不對外表現。在vlan中,位於primary vlan中的端口是promiscuous port,位於isolated vlan中的端口是isolated port,位於community vlan中的端口是community port。

配置代碼:(因爲沒有找到能夠模擬private vlan這個功能的模擬器,所以轉載了這個朋友的代碼)

switch(config)#vtp mode transparent   #VTP版本設置爲12,並且要求工作在transparent模式下
switch(config)# vlan 200
switch(config-vlan)#private-vlan community   #定義vlan 200爲團體vlan
switch(config)#vlan 300
switch(config-vlan)#private-vlan isolated   #定義vlan 300爲隔離vlan
switch(config)#vlan 100
switch(config-vlan)#private-vlan primary   #定義vlan 100爲主vlan
switch(config-vlan)#private-vlan association 200,300   #進入主vlan中,將所有輔助vlan關聯到主vlan。這裏可以配置添加哪些輔助vlan的關聯或移除哪些輔助vlan的關聯。
switch(config)#interface range fa0/1 – 2
switch(config-if)#switchport mode private-vlan host   #配置fa0/1 – 2爲主機端口
switch(config-if)# switchport private-vlan host-assocition 100 200   #在主機端口上配置PVLAN的端口關聯  
switch(config)#interface fa0/3 – 4
switch(config-if)#switchport mode private-vlan host   #配置fa0/3 – 4爲主機端口
switch(config-if)# switchport private-vlan host-assocition 100 300   #在主機端口上配置PVLAN的端口關聯
switch(config)#interface fa0/24   #配置fa0/24爲混雜端口
switch(config-if)#switchport mode private-vlan promiscuous
switch(config-if)# switchport private-vlan mapping 100 200,300   #在混雜端口上配置PVLAN的端口關聯

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章