Private VLAN配置(完整步骤)

Private VLANs 动机

§ 在有些情况下,希望隔离位于同一VLAN中终端设备间的通信,又不希望划分不同IP子网造成IP地址浪费。

§ 私有VLAN技术可以隔离用一个IP子网内的二层设备。

                                               

§ 交换机一些端口的流量只能到达某些与默认网关或备份服务器相连的端口。

§ 这样,虽然有些设备属于同一VLAN,但他们之间却不能相互通信。

§ 私有VLAN主要部署在ISP环境中------特别是部署Web环境。

§ 目前很多厂商生产的交换机支持PVLAN技术,PVLAN技术在解决通信安全、防止广播风暴和浪费IP地址方面的优势是显而易见的,而且采用PVLAN技术有助于网络的优化,再加上PVLAN在交换机上的配置也相对简单,PVLAN技术越来越得到网络管理人员的青睐。

§ PVLAN可以让交换机共享一部分端口,又隔离一部分端口,同时所有端口还都属于同一个VLAN。

PVLAN的架构

                                                    

一个杂合端口只能为一个主VLAN提供服务,但一个杂合端口可以为一个孤立VLAN或多个团体VLAN提供服务。

                                                           

PVLAN端口类型

• 杂合端口(Promiscuous):与所有VLAN中的端口通信,包括团体端口和孤立端口。一般是连接路由器端口、备份或共享服务器端口或者VLAN接口。

• 孤立端口(Isolated):与同一个主VLAN中的其他端口隔离,只能与杂合端口进行通信。

• 团体端口(Community):同一团体VLAN中的团体端口之间可以进行通信,也可和杂合端口通信。不同团体VLAN中的端口不能通信。

杂合端口只是主VLAN的一部分,但是每个杂合端口都可以对应一个以上的辅助VLAN。

                                                  

Cisco IOS中配置pVLANs命令

§ 步骤1:进入VLAN全局配置模式来配置pVLAN

Switch(config)# vlan pvlan-id

§ 步骤2:将VLAN类型配置为pVLAN

Switch(config-vlan)#private-vlan {community | isolated | primary}

§ 步骤3:退出配置模式

Switch(config-vlan)#exit

§ 步骤4:进入VLAN全局配置模式来配置主VLAN

Switch(config)#vlan primary-vlan-id

§ 步骤5:如果配置主VLAN,要确保有二层辅助VLAN管理到了主VLAN

Switch(config-vlan)#private-vlan association {secondary-vlan-list | add secondary-vlan-list | remove secondary-vlan-list}

§ 步骤6:选择主VLAN的接口配置模式

Switch(config)#interface vlan primary-vlan-id

§ 步骤7:将辅助VLAN映射到主VLAN的三层VLAN接口,使pVLAN入口流量能够执行三层交换

Switch(config-if)#private-vlan mapping {secondary-vlan-list | add secondary-vlan-list | remove secondary-vlan-list }

§ 步骤8:选择用来充当pVLAN主机或杂合端口的LAN端口

Switch(config)# interface type slot/port

§ 步骤9:如果交换机端口默认工作在三层,那么将LAN端口配置为二层端口

Switch(config-if)# swtchport

§ 步骤10:将二层端口配置为pVLAN的主机端口或杂合端口

Switch(config-if)# switchport mode private-vlan {host | promiscuous}

§ 步骤11:为了能够访问pVLAN的端口,需要将团体或孤立私有VLAN关联给pVLAN

Switch(config-if)# switchport private-vlan host-association primary-vlan-id secondary-vlan-id

§ 步骤12:将杂合端口映射到pVLAN

Switch(config-if)# switchport private-vlan mapping primary-vlan-id {secondary-vlan-list | add secondary-vlan-list | remove secondary-vlan-list}

§ 步骤13:退出接口配置模式

Switch(config-if)# exit

§ 步骤14:验证:

show interface type slot/port switchport

show vlan private-vlan

案例:


                                                       

Switch(config)# vlan 201

Switch(config-vlan)# private-vlan isolated

Switch(config)# vlan 202

Switch(config-vlan)# private-vlan community

Switch(config)# vlan 100

Switch(config-vlan)# private-vlan primary

Switch(config-vlan)# private-vlan association 201,202

Switch(config)# interface fastethernet 0/24

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

Switch(config-if)# switchport private-vlan mapping 100 201,202

Switch(config)# interface range fastethernet 0/1 - 2

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

Switch(config-if)# switchport private-vlan host-association 100 202

Switch(config)# interface range fastethernet 0/3 - 4

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

Switch(config-if)# switchport private-vlan host-association 100 201


猜你喜欢

转载自blog.csdn.net/weixin_42442713/article/details/80925246
今日推荐