实验需求:
实验拓扑:
实验分析:
Pc1/3和pc2/4/5/6不在一个网段,pc1/3为vlan2,,pc1/3可以正常访问pc4/5/6,而pc4/5不能访问pc6
实验配置:
Sw1:
[sw1]vlan batch 2 to 5
[sw1]int Eth0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port hybrid pvid vlan 3
[sw1-Ethernet0/0/2]port hybrid untagged vlan 3 to 5
[sw1-Ethernet0/0/2]q
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 5
[sw1-GigabitEthernet0/0/2]int g0/0/1
[sw1-GigabitEthernet0/0/1]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 5
Sw2:
[sw2]vlan batch 2 to 5
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 2
[sw2-Ethernet0/0/1]q
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]port hybrid pvid vlan 4
[sw2-Ethernet0/0/2]port hy untagged vlan 3 to 4
[sw2-Ethernet0/0/2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 5
[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]port hybrid tagged vlan 3 to 4
Sw3:
[sw3]vlan batch 2 to 5
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port hybrid pvid vlan 4
[sw3-Ethernet0/0/1]port hybrid untagged vlan 3 to 4
[sw3-Ethernet0/0/1]int e 0/0/2
[sw3-Ethernet0/0/2]port hybrid pvid vlan 5
[sw3-Ethernet0/0/2]port hybrid untagged vlan 3 5
[sw3-Ethernet0/0/2]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 5
R1:
创建子接口
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0.1]q
创建地址池
[r1]dhcp enable
[r1]ip pool v2
[r1-ip-pool-v2]network 192.168.2.0 mask 24
[r1-ip-pool-v2]gateway-list 192.168.2.1
[r1-ip-pool-v2]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-v2]q
[r1]ip pool v3
[r1-ip-pool-v3]network 192.168.1.0 mask 24
[r1-ip-pool-v3]gateway-list 192.168.1.1
[r1-ip-pool-v3]dns-list 114.114.114.144 8.8.8.8
[r1-ip-pool-v3]q
进入接口启dhcp
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global
实验验证: