实验要求
1.PC1和PC3所在的接口为access,属于 vlan2
PC2、PC4、PC5、PC6处于同一网段;其中PC2可以访问PC4、PC5、PC6;但PC4可以访问PC5,不能访问PC6
2.PC5不能访问PC6
3.PC1、PC3与PC2、PC4、PC5、PC6不在同一网段
4.所有PC通过DHCP获取IP地址,且PC1/3可以正常访问PC2/4/5/6
配置SW接口及vlan
SW1
[SW1]vlan batch 2 to 6
[SW1]int g 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 2
[SW1-GigabitEthernet0/0/1]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]int g 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type trunk
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6
[SW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
SW2
[SW2]vlan batch 2 to 6
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 2
[SW2-GigabitEthernet0/0/1]int g 0/0/2
[SW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[SW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5
[SW2-GigabitEthernet0/0/2]int g 0/0/3
[SW2-GigabitEthernet0/0/3]port link-type trunk
[SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/3]int g 0/0/4
[SW2-GigabitEthernet0/0/4]port link-type trunk
[SW2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
SW3
[SW3]vlan batch 2 to 6
[SW3]int g 0/0/1
[SW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[SW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[SW3-GigabitEthernet0/0/2]int g 0/0/2
[SW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 6
[SW3-GigabitEthernet0/0/1]int g 0/0/3
[SW3-GigabitEthernet0/0/3]port link-type trunk
[SW3-GigabitEthernet0/0/3]port trunk allow-pass vlan all
在R1配置DHCP和子接口
[Huawei]sys R1
[R1]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[R1]dhcp enable
[R1]ip pool dhcp1
[R1-ip-pool-dhcp1]network 192.168.1.0 mask 24
[R1-ip-pool-dhcp1]gateway-list 192.168.1.1
[R1-ip-pool-dhcp1]dns-list 114.114.114.114 8.8.8.8
[R1]ip pool dhcp2
[R1-ip-pool-dhcp2]network 192.168.2.0 mask 24
[R1-ip-pool-dhcp2]gateway-list 192.168.2.1
[R1-ip-pool-dhcp2]dns-list 114.114.114.114 8.8.8.8
[R1-GigabitEthernet0/0/0]dhcp select global
[R1-GigabitEthernet0/0/0]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global