【每日必学】配置私有 VLAN
发布作者:微思网络 发布时间:2017-04-12 浏览量:0次
一、拓扑
二、实验需求
1、主 VLAN100 的 PVLAN 的配置,包括团体 VLAN200 和隔离 VLAN300,端口 F0/1 和 F0/2 被绑定到团体 VLAN200,端口 F0/3 和 F0/4 被绑定到隔离 VLAN300,主 VLAN100 三层路由接口允许对辅助 VLAN200 和 VLAN300 的流量进行路由选择。
泉州CCNA培训教你配置 SW1:
ip routing //启用 IP 路由功能
vtp mode transparent //配置 VTP 透明模式
Vlan 100
private-vlan primary //配置 VLAN100 为主 VLAN
Vlan 200
private-vlan community //配置 VLAN200 为辅助团体 VLAN
vlan 300
private-vlan isolated //配置 VLAN300 为辅助隔离 VLAN
Vlan 100
private-vlan association 200,300 //把辅助 VLAN200,300 关联到主 VLAN100
Interface F0/1
switchport mode private-vlan host
switchport private-vlan host-association 100 200 //把 F0/1 配置为团体 VLAN 端口
Interface F0/2
switchport mode private-vlan host
switchport private-vlan host-association 100 200 //把 F0/2 配置为团体 VLAN 端口
Interface F0/3
switchport mode private-vlan host
switchport private-vlan host-association 100 300 //把 F0/3 配置为隔离 VLAN 端口
Interface F0/4
switchport mode private-vlan host
switchport private-vlan host-association 100 300 //把 F0/4 配置为隔离 VLAN 端口
Interface vlan 100
ip address 10.1.1.254 255.255.255.0 private-vlan mapping add 200,300
//配置辅助 VLAN200,300 可以用主 VLAN100 的 IP 地址进行路由,或作为网关使用。
测试:
PC1 可以 ping 通 PC2
PC3 不能 ping 通 PC4
VLAN200 的 PC1 或 PC2 ping 不通 VLAN300 的 PC3 或 PC4
2、配置 F0/5 接口作为混杂接口,允许辅助 VLAN200 和 VLAN300 访问服务器。
配置 SW1:
interface FastEthernet0/5
switchport private-vlan mapping 100 200,300
switchport mode private-vlan promiscuous //配置 F0/5 作为混杂端口
测试:VLAN200 和 VLAN300 的 PC 都可以 ping 通服务器 10.1.1.5
3、允许辅助 VLAN200 和 VLAN300 能够通过 R1 访问 Internet
配置 SW1:
interface F0/24 no switchport
ip address 10.1.2.254 255.255.255.0 no shut
ip route 0.0.0.0 0.0.0.0 10.1.2.253 //配置 SW1 的默认路由到 R1,为上网而用
配置 R1:
interface F0/0
ip address 10.1.2.253 255.255.255.0