要求:
1,PC1和PC2所在接口为ACCESS;属于VLAN2。
PC2/4/5/6处于同一网段;其中PC2可以访问PC4/5/6;但PC4可以访问PC5,不能访问PC6。
2,PC5不能访问PC6。
3,PC1/3与PC2/4/5/6不在同一个网段。
4,所有PC通过DHCP获取IP 地址,且PC1/3可以正常访问PC2/4/5/6。
首先明确一点:物理接口可以识别的是不代标签的帧。
第一步:先配交换部分
创建VLAN:
[sw1]vlan batch 2 to 6
[sw2]vlan batch 2 to 6
[sw3]vlan batch 2 to 6
划分VLAN:
[sw1]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]int g 0/0/1
[sw1-GigabitEthernet0/0/1]p l a
[sw1-GigabitEthernet0/0/1]p d v 2
[sw1-GigabitEthernet0/0/1]q
[sw1]int g 0/0/2
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6 --- 全部不代标签
[sw1-GigabitEthernet0/0/2]q
[sw1]int g 0/0/3
[sw1-GigabitEthernet0/0/3]port hybrid tagged vlan all
[sw1-GigabitEthernet0/0/3]
[sw2]int g 0/0/3
[sw2-GigabitEthernet0/0/3]port l a
[sw2-GigabitEthernet0/0/3]p d v 2
[sw2-GigabitEthernet0/0/3]q
[sw2]int g 0/0/4
[sw2-GigabitEthernet0/0/4]port hybrid pvid vlan 4
[sw2-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5
[sw2-GigabitEthernet0/0/1]port link-type
[sw2-port-group-link-type]q
[sw2]int g 0/0/1
[sw2-GigabitEthernet0/0/1]p l t
[sw2-GigabitEthernet0/0/1]port trunk a v a
[sw2-GigabitEthernet0/0/1]int g 0/0/2
[sw2-GigabitEthernet0/0/2]port link trunk
[sw2-GigabitEthernet0/0/2]port trunk a vlan all
[sw3]int g 0/0/2
[sw3-GigabitEthernet0/0/2]port hybrid pvid vlan 5
[sw3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5
[sw3-GigabitEthernet0/0/2]int g 0/0/3
[sw3-GigabitEthernet0/0/3]port hybrid pvid vlan 6
[sw3-GigabitEthernet0/0/3]port hybrid untagged vlan 3 6
[sw3-GigabitEthernet0/0/3]int g 0/0
Oct 20 2021 16:41:47-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 9, the c
hange loop count is 0, and the maximum number of records is 4095./1
[sw3-GigabitEthernet0/0/1]port link trunk
[sw3-GigabitEthernet0/0/1]port trunk a
[sw3-GigabitEthernet0/0/1]p t a v a
[sw3-GigabitEthernet0/0/1]
Oct 20 2021 16:42:27-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 11, the
change loop count is 0, and the maximum number of records is 4095.
查看各交换机:
第二步:配路由器 (给VLAN 2 ----192.168.1.0/24 其他的 ----- 192.168.2.0/24)
第三步:做DHCP
最后一步:将PC均更改为DHCP获取,查看如下:
测试需求是否达到:
PC2可以到达PC4、5、6:
PC4 可以访问PC5,但不能访问PC6:
PC5不能访问PC6:
PC1/3可以正常访问PC2、4、5、6: