PVLAN组网实验

一,PVLAN类型

主VLAN

主VLAN可以由多个辅助私用VLAN组成,而这些辅VLAN与主VLAN属于同一子网。

辅助VLAN 

①  团体VLAN:如果某个端口属于团体VLAN,那么它就不仅能够与相同团体VLAN中的其他端口进行通信,而且还能够与PVLAN的混合端口进行通信。

②  隔离VLAN:如果某个端口属于隔离VLAN,那么它就只能与混合端口进行通信。同一个隔离VLAN中的端口间不能通信,而只能与混合端口进行通信。每个PVLAN中只能有一个隔离VLAN。

二,实验目的

利用PVLAN技术实现

①vlan20内PC能互通,且都能访问网关

②vlan30内PC不互通,但都能访问网关

③vlan20内PC,不能与vlan30内PC互通

四,配置命令

Router

Router>enable
Router#configure terminal
Router(config)#int e0/0                       主接口对应native vlan

Router(config-if)#ip address 192.168.1.11 255.255.255.0        配置网关
Router(config-if)#no shutdown             打开主接口

PC1 

VPCS> ip 192.168.1.1 24  192.168.1.11      配置PC1的IP地址

VPCS> ping 192.168.1.11                            测试能ping通网关

PC2 

VPCS> ip 192.168.1.2 24 192.168.1.11       配置PC2的IP地址

VPCS> ping 192.168.1.11                            测试能ping通网关

PC3

VPCS> ip 192.168.1.3 24 192.168.1.11       配置PC3的IP地址

VPCS> ping 192.168.1.11                            测试能ping通网关

PC4 

VPCS> ip 192.168.1.4 24 192.168.1.11       配置PC4的IP地址

VPCS> ping 192.168.1.11                            测试能ping通网关

Switch

Switch>enable
Switch#configure terminal
Switch(config)#vtp mode off                           关闭vtp

-
Switch(config)#vlan 10                               
Switch(config-vlan)#private-vlan primary        创建主vlan10
Switch(config-vlan)#exit

-
Switch(config)#vlan 20
Switch(config-vlan)#private-vlan community    创建团体vlan
Switch(config-vlan)#exit

-
Switch(config)#vlan 30
Switch(config-vlan)#private-vlan isolated          创建隔离vlan
Switch(config-vlan)#exit

-
Switch(config)#vlan 10

Switch(config-vlan)#private-vlan association add 20,30           主与辅助vlan映射
Switch(config-vlan)#exit

-

Switch(config)#int range e0/1-2
Switch(config-if-range)#switchport mode private-vlan host                       配置主机端口
Switch(config-if-range)#switchport private-vlan host-association 10 20    绑定vlan
Switch(config-if-range)#exit

-
Switch(config)#int range e1/1-2
Switch(config-if-range)#switchport mode private-vlan host                         配置主机端口
Switch(config-if-range)#switchport private-vlan host-association 10 30      绑定vlan
Switch(config-if-range)#exit

-
Switch(config)#int e0/0
Switch(config-if)#switchport mode private-vlan promiscuous                 配置混杂端口
Switch(config-if)#switchport private-vlan mapping 10 add 20,30            配置混杂端口所在的主vlan以及关联的辅助vlan

-

Switch(config-if)#end

Switch#show running-config      查看运行配置

六,实验测试

PC1测试

ping 192.168.1.11       可以与网关互通

ping 192.168.1.2         团体vlan内部能互访

ping 192.168.1.3         团体vlan与隔离vlan不能互访

PC4测试

ping 192.168.1.11        可以与网关互通

ping 192.168.1.3          隔离vlan内部不能互访

ping 192.168.1.1          团体vlan与隔离vlan不能互访

  • 31
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值