一,拓扑和提示
PVID:贴标签(收到无标签帧时)
u :收到带标签帧时摘标签,在放通
T:收到带标签帧时不摘标签,就可以放通
vlan2;192.168.1.0/24
vlan3;192.168.2.0/24
二,要求
1、PC1机Pc3所在接口为Access接口
Pc2/4/5/6处于同一网段,其中Pc2可以访问PC4/5/6
Pc4可以访问Pc5,但不能访问Pc6
PC5不能访问Pc6
2.PC1/3与PC2/4/5/6不再同一网段
3.所有Pc通过DHcP获取Ip地址,且Pc1/3可以正常访问PC2/4/5/6
三,配置
r1
[r1]vlan 2
[r1]vlan 3
[r1]dhcp enable
[r1]interface GigabitEthernet 0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1]interface GigabitEthernet 0/0/0.2
[r1-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.2]arp broadcast enable
[r1-GigabitEthernet0/0/0.2]dhcp select global
[r1]ip pool 1
[r1-ip-pool-1]gateway-list 192.168.1.254
[r1-ip-pool-1]network 192.168.1.0 mask 24
[r1-ip-pool-1]dns-list 1.1.1.1
[r1]ip pool 2
[r1-ip-pool-2]gateway-list 192.168.2.254
[r1-ip-pool-2]network 192.168.2.0 mask 24
[r1-ip-pool-2]dns-list 2.2.2.2
sw1
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[sw1]interface GigabitEthernet 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type hybrid
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 2
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 2 3
[sw1]interface GigabitEthernet 0/0/3
[sw1-GigabitEthernet0/0/3]port link-type hybrid
[sw1-GigabitEthernet0/0/3]port hybrid pvid vlan 3
[sw1-GigabitEthernet0/0/3]port hybrid untagged vlan 2 3
[sw1]interface GigabitEthernet 0/0/5
[sw1-GigabitEthernet0/0/5]port link-type trunk
[sw1-GigabitEthernet0/0/5]port trunk allow-pass vlan 2 3
sw2
[sw2]vlan batch 2 to 6
[sw2]interface GigabitEthernet 0/0/1
[sw2-GigabitEthernet0/0/1]port link-type hybrid
[sw2-GigabitEthernet0/0/1]port hybrid pvid vlan 2
[sw2-GigabitEthernet0/0/1]port hybrid untagged vlan 4 5 6
[sw2-GigabitEthernet0/0/1]port hybrid tagged vlan 2 3
[sw2]interface GigabitEthernet 0/0/3
[sw2-GigabitEthernet0/0/3]port link-type hybrid
[sw2-GigabitEthernet0/0/3]port hybrid untagged vlan 4 5 6
[sw2]interface GigabitEthernet 0/0/4
[sw2-GigabitEthernet0/0/4]port hybrid pvid vlan 4
[sw2-GigabitEthernet0/0/4]port hybrid untagged vlan 2 3
[sw2]interface GigabitEthernet 0/0/2
[sw2-GigabitEthernet0/0/2]port link-type trunk
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 6
sw3
[sw3]vlan batch 2 to 6
[sw3]interface GigabitEthernet 0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
[sw3]interface GigabitEthernet 0/0/3
[sw3-GigabitEthernet0/0/3]port link-type hybrid
[sw3-GigabitEthernet0/0/3]port hybrid pvid vlan 5
[sw3-GigabitEthernet0/0/3]port hybrid untagged vlan 2 to 5
[sw3]interface GigabitEthernet 0/0/4
[sw3-GigabitEthernet0/0/4]port link-type hybrid
[sw3-GigabitEthernet0/0/4]port hybrid pvid vlan 6
[sw3-GigabitEthernet0/0/4]port hybrid untagged vlan 2 3 6