需求:1.PC1和PC3所在介面為access介面;屬於VLAN 2
PC2-4-5-6處於同一網段:其中PC2可以訪間Pc4-5-6
PC4可以訪間Pc5不能訪間PC6
Pc5不能訪問Pc6
3.PC1-Pc3---192.168.0.0 24與PC2-4-5-6不在一個網段--192.168.1.0 24
4.所有Pc均使用DHcp禁取IP地址,且PC1可以正常訪間Pc2-4-5-6
第一步建立VLAN
[SW1]vlan batch 2 to 6
[SW2]vlan batch 2 to 6
SW1配置如下:
[SW1]int g 0/0/3
[SW1-GigabitEthernet0/0/3]port link-type access
[SW1-GigabitEthernet0/0/3]port default vlan 2
[SW1-GigabitEthernet0/0/4] port hybrid untagged vlan 2
[SW1-GigabitEthernet0/0/4] port hypvid vlan 3
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass 2 to 6
[sw1-GigabitEthernet0/0/1]port hybird untagged vlan 2
[sw1-GigabitEthernet0/0/1]port hybird untagged vlan 3 4 5 6
SW2配置如下:
[SW2]int g 0/0/3
[SW2-GigabitEthernet0/0/3]port link-type access
[SW2-GigabitEthernet0/0/3]port default vlan 2
[SW2-GigabitEthernet0/0/4]port link-type hybird
[SW2-GigabitEthernet0/0/4]port hybird untagged vlan 2 3 4 5
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
[sw2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 6
[SW2-GigabitEthernet0/0/4]port hybird pvid vlan 4
SW3配置如下:
[SW3]vlan batch 2 to 6
[SW3-GigabitEthernet0/0/2]port link-type hybird
[SW3-GigabitEthernet0/0/2]port hybird untagged vlan 2 3 4 5
[SW3-GigabitEthernet0/0/2]port hybird pvid vlan 5
[SW3-GigabitEthernet0/0/3]port link-type hybird
[SW3-GigabitEthernet0/0/3]port hybird untagged vlan 2 3 6
[SW3-GigabitEthernet0/0/3]port hybird pvid vlan 6
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
r1配置:
[r1-GigabitEthernet0/0/0.1]ip address 192.168.0.1 24
[r1-GigabitEthernet0/0/0.1]dotlq termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0] ip address 192.168.1.1 24
[r1]dhcp enable
[r1]ip pool aa
[r1-ip-pool-aa]network 192.168.0.0 mask 24
[r1-ip-pool-aa]gateway-list 192.168.0.1
c
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1]ip pool bb
[r1-ip-pool-bb]network 192.168.1.0 mask 24
[r1-ip-pool-bb]gateway-list 192.168.1.1
[r1-ip-pool-bb]network 192.168.0.0 mask 24
[r1-GigabitEthernet0/0/0]dhcp select global
經過配置後可以