一、实验要求
二、实验分析
1、将pc1/3 归入vlan 2,pc2归为vlan 3,pc4/5/6归为vlan4/5/6,并在路由器上开启一个子接口,单独管理vlan2,为vlan 2分配ip地址,物理接口为其他接口分配ip地址
2、在3号交换机的0/0/4号接口,使将vlan4/5出交换机的修改为携带标签,从而实现pc4/5不能访问pc6.
三、实验过程
1、路由器配置
#配置DHCP
[r1]dhcp enable
[r1]ip pool aa
Info: It's successful to create an IP address pool.
[r1-ip-pool-aa]network 192.168.1.0 mask 24
[r1-ip-pool-aa]gateway-list 192.168.1.1
[r1-ip-pool-aa]dns-list 114.114.114.114
[r1]ip pool bb
Info: It's successful to create an IP address pool.
[r1-ip-pool-bb]network 192.168.2.0 mask 24
[r1-ip-pool-bb]gateway-list 192.168.2.1
[r1-ip-pool-bb]dns-list 114.114.114.114
#配置接口
[r1]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip add 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]dhcp select global
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[r1-GigabitEthernet0/0/0]dhcp select global
2、交换机SW1配置
[sw1]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw1]
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 2
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type hybrid
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6
[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type trunk
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[sw1]int g0/0/4
[sw1-GigabitEthernet0/0/4]port link-type hybrid
[sw1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6
3、交换机SW2配置
[sw2]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw2]
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 2
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]port link-type hybrid
[sw2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[sw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5
[sw2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type trunk
[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[sw2]int g0/0/4
[sw2-GigabitEthernet0/0/4]port link-type trunk
[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
4、交换机SW3配置
[sw3]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[sw3]
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type hybrid
[sw3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[sw3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[sw3]int g0/0/2
[sw3-GigabitEthernet0/0/2]port link-type hybrid
[sw3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[sw3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 6
[sw3]int g0/0/4
[sw3-GigabitEthernet0/0/4]port link-type trunk
[sw3-GigabitEthernet0/0/4]port trunk allow-pass vlan all
四、实验结果