实验要求
sw1
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port link-type access
port default vlan 2
#
interface Ethernet0/0/3
port hybrid pvid vlan 3
port hybrid untagged vlan 2 to 6 //没有不可访问pc 2 的电脑所以vlan2到6都可以
#
interface Ethernet0/0/4
port link-type access
port default vlan 2
#
interface Ethernet0/0/5
port hybrid pvid vlan 4
port hybrid untagged vlan 2 to 6 //没有不可访问pc 2 的电脑所以vlan2到6都可以
#
interface Ethernet0/0/6
port hybrid tagged vlan 2
port hybrid untagged vlan 3 to 6 //需要撕掉标签才能使路由器的DHCP批量分配给vlan3到6 地址
#
sw2
vlan b 2 t 6
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface Ethernet0/0/2
port hybrid pvid vlan 5
port hybrid untagged vlan 2 to 3 5 to 6 //应为pc 4不可访问pc5 所以不允许vlan4通过
#
interface Ethernet0/0/3
port hybrid pvid vlan 6
port hybrid untagged vlan 2 to 3 6 //因为pc4/pc5不可访问pc 6所以不允许vlan 4 vlan 5通过
r1
给接口配IP地址并打开DHCP
interface Ethernet0/0/0
ip address 192.168.2.254 255.255.255.0
dhcp select global
#
interface Ethernet0/0/0.1
dot1q termination vid 2
ip address 192.168.1.254 255.255.255.0
dhcp select global
创建地址池
ip pool v2
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
#
ip pool v3456
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
测试截图
pc4 无法访问pc5/6 可以访问 pc 1/2/3
pc5 无法访问 pc6
pc3可以访问pc2 4 5 6