一、实验拓扑
二、实验要求
1、pc1和pc3所在接口为access;属于vlan 2;
pc2/pc4/pc5/pc6处于同一网段:其中pc2可以访问pc4/pc5/pc6,pc4可以访问pc6,pc5不能访问pc6;
2、PC4pc1/pc3与pc2/pc4/pc5/pc6不在同一网段;
3、所有pc通过DHCP获取Ip地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;
三、实验思路
- 先创建VLAN
- 再配置接口类型及增删标签
- 配置两个地址池
四、实验步骤
-
先创建VLAN
sw1:
[sw1]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...
sw2:
[sw2]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...
sw3:
[sw3]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment..
2、 再配置接口类型及增删标签
sw1:
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 2
[sw1]int g 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type hybrid
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[sw1]int g 0/0/3
[sw1-GigabitEthernet0/0/3]port link-type trunk
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[sw1]int g 0/0/4
[sw1-GigabitEthernet0/0/4]p l h
[sw1-GigabitEthernet0/0/4]p h u v 3 4 5 6
[sw1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
sw2:
[sw2]int g 0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 2
[sw2]int g 0/0/2
[sw2-GigabitEthernet0/0/2]p l h
[sw2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[sw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[sw2]int g 0/0/3
[sw2-GigabitEthernet0/0/3]p l t
[sw2-GigabitEthernet0/0/3]p t a v 2 t 6
[sw2]int g 0/0/4
[sw2-GigabitEthernet0/0/4]p l t
[sw2-GigabitEthernet0/0/4]p t a v 2 t 6
sw3:
[sw3]int g 0/0/1
[sw3-GigabitEthernet0/0/1]p l h
[sw3-GigabitEthernet0/0/1]p h p v 5
[sw3-GigabitEthernet0/0/1]p h u v 3 4 5
[sw3]int g 0/0/2
[sw3-GigabitEthernet0/0/2]p l h
[sw3-GigabitEthernet0/0/2]p h p v 6
[sw3-GigabitEthernet0/0/2]p h u v 3 4 6
[sw3]int g 0/0/3
[sw3-GigabitEthernet0/0/3]p l t
[sw3-GigabitEthernet0/0/3]p t a v
[sw3-GigabitEthernet0/0/3]p t a v 2 3 4 5 6
3、 配置两个地址池
R1:
(1):配置IP地址,子接口2.0,物理口1.0
[Huawei]sy R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]ip address 192.168.2.1 24
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
(2):配置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-aa]q
[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