应用背景:Pvlan主要应用于电信级网络和写字楼网络,智能小区,商务写字楼,城域以太网

概念术语

  Primary VLAN 主VLAN

  Secondary VLAN 辅助VLAN

  Isolated vlan 隔离VLAN

  Community vlan 团体VLAN

  Promiscuos port 混杂端口

  解释:

  Primary VLAN:是一个全局VLAN的标识

  Isolated VLAN:同属一个隔离VLAN间的用户是不能够互相访问的,但是可以跟主VLAN和混杂端口通信

  Community VLAN:同属同一个团体VLAN内的用户,是能够直接互相访问的,且可以跟主VLAN和混杂端口通信

  Promiscuous port:连接计费服务器、网关或路由器等,可以跟所有的其它端口通信

配置方法(参考):

  //划分主VLAN

  Switch(config)# vtp mode transparent //VTP设为透明模式

  Switch(config)#vlan 800

  Switch(config-vlan)#private-vlan primary

  //划分团体VLAN

  Switch(config)#vlan 511

  Switch(config-vlan)#private-vlan community

  //划分隔离VLAN

  Switch(config)#vlan 522

  Switch(config-vlan)#private-vlan isolated

  //设定某一物理端口为混杂端口 F0/5

  Switch(config)#interface F0/5

  Switch(config-if)# switchport mode private-vlan promiscuous

  Switch(config-if)# switchport private-vlan mapping 800 add 511,522

  //将团体VLAN和隔离VLAN与主VLAN关联

  Switch(config)#vlan 800

  Switch(config-vlan)#private-vlan association 511,522

  //将团体VLAN 511关联到F0/10和F0/11接口上,并能够与主VLAN 800进行通信

  Switch(config)#interface rang F0/10 , f0/11

  Switch(config-if-rang)#switchport mode private-vlan host

  Switch(config-if-rang)#switchport private-vlan host-association 800 511

  //将隔离VLAN 522关联到F0/20和F0/21接口上,并能够与主VLAN 800进行通信

  Switch(config)#interface range F0/20 , f0/21

  Switch(config-if-range)#switchport mode private-vlan host

  Switch(config-if-range)#switchport private-vlan host-association 800 522

  //将其它各个辅助VLAN映射到主VLAN中,以实现跟主VLAN进行直接通信

  Switch(config)#interface vlan 800

  Switch(config-if)#private-vlan mapping 511,522

  pVLAN实验的完整配置如下:(交换机配置)

  SW(config)# vlan 10

  SW(config-vlan)# private-vlan isolated

  SW(config)# vlan 20

  SW(config-vlan)# private-vlan community

  SW(config)# vlan 800

  SW(config-vlan)# private-vlan primary

  SW(config-vlan)#private-vlan association 10,20

  SW(config)# interface FastEthernet0/1

  SW(config-if)# switchport private-vlan host-association 800 10

  SW(config-if)# switchport mode private-vlan host

  SW(config-if)# spanning-tree portfast

  SW(config)# interface FastEthernet0/2

  SW(config-if)# switchport private-vlan host-association 800 10

  SW(config-if)# switchport mode private-vlan host

  SW(config-if)# spanning-tree portfast

  SW(config)# interface FastEthernet0/3

  SW(config-if)# switchport private-vlan host-association 800 20

  SW(config-if)# switchport mode private-vlan host

  SW(config-if)# spanning-tree portfast

  SW(config)# interface FastEthernet0/4

  SW(config-if)# switchport private-vlan host-association 800 20

  SW(config-if)# switchport mode private-vlan host

  SW(config-if)# spanning-tree portfast

  SW(config)# interface FastEthernet0/5

  SW(config-if)# switchport private-vlan mapping 800 10,20

  SW(config-if)# switchport mode private-vlan promiscuous

  SW(config-if)# spanning-tree portfast

  SW(config)# interface Vlan800

  SW(config-if)# private-vlan mapping 10,20

  SW(config-if)# end

  测试结果:隔离VLAN 10之间不能够通信,但可以跟SERVER端口通信

  团体VLAN 20 不能跟隔离VLAN通信,可以跟自己VLAN内的用户通信,同时也可以跟SERVER端口通信

  混杂端口可以跟所有的用户进行通信