一、实验拓扑
二、实验要求
1、pc1和pc3所在接口为access;属于vlan2;
pc可以号间pe.ce0不一网段:其中pc2可以访问pc4/pc5/pc6;
pc4可以访问pc6;pc5不能访问pc6;
2、pc1/pc3与pc2/pc4/pc5/pc6不在同一网段;
3、所有pc通过DHcP获职IP地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;
三、实验思路
1、PC端设置DHCP自动获取IP地址;
2、创建vlan;
3、进入到交换机的接口下加入VLAN;
4、给路由器的子接口(VLAN 2)和物理接口(VLAN 3/4/5/6 )分别配置IP地址;
5、在路由器上创建两个地址池,并开启DHCP服务;
四、实验步骤
1、PC端设置DHCP自动获取IP地址
2、创建vlan
[LSW1]VLAN batch 2 to 6
[LSW2]vlan batch 2 to 6
[LSW3]vlan batch 2 to 6
3、进入到交换机的接口下加入VLAN
[LSW1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]port link-type access
[LSW1-GigabitEthernet0/0/2]port default vlan 2
[LSW1-GigabitEthernet0/0/2]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port hybrid pvid vlan 3
[LSW1-GigabitEthernet0/0/3]port hybrid untagged vlan 3 to 6
[LSW1]int g0/0/4
[LSW1-GigabitEthernet0/0/4]port link-type trunk
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
[LSW1-GigabitEthernet0/0/4]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 6
[LSW1-GigabitEthernet0/0/1]port hybrid tagged vlan 2
[LSW2-GigabitEthernet0/0/2]port link-type access[LSW2-GigabitEthernet0/0/2]port default vlan 2
[LSW2-GigabitEthernet0/0/2]int g 0/0/3
[LSW2-GigabitEthernet0/0/3]port hybrid pvid vlan 4
[LSW2-GigabitEthernet0/0/3]port hybrid untagged vlan 3 to 6
[LSW2-GigabitEthernet0/0/3]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
[LSW2-GigabitEthernet0/0/1]int g 0/0/4
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6
[LSW3]int g 0/0/1[LSW3-GigabitEthernet0/0/1]port link-type trunk
[LSW3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 6
[LSW3-GigabitEthernet0/0/1]]int g 0/0/2
[LSW3-GigabitEthernet0/0/2]port hybrid pvid vlan 5
[LSW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5
[LSW3-GigabitEthernet0/0/2]int g 0/0/3
[LSW3-GigabitEthernet0/0/3]port hybrid pvid vlan 6
[LSW3-GigabitEthernet0/0/3]port hybrid untagged vlan 3 4 6
查看接口下vlan的状态:
4、给路由器的子接口(VLAN 2)和物理接口(VLAN 3/4/5/6 )分别配置IP地址
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add
[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 //接口开启802.1q帧识别
[R1-GigabitEthernet0/0/0.1]arp broadcast enable //开启arp广播协议
查看以下接口的IP地址:
5、在路由器上创建两个地址池,并开启DHCP服务
[R1]dhcp enable
[R1]ip pool aa
[R1-ip-pool-aa]network 192.168.2.0 mask 24
[R1-ip-pool-aa]gateway-list 192.168.2.1
[R1-ip-pool-aa]dns-list 8.8.8.8
[R1]int g 0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1]dhcp enable
[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]dns-list 8.8.8.8
[R1]int g 0/0/0.1
[R1-GigabitEthernet0/0/0]dhcp select global
pc2访问pc4/pc5/pc6:
pc4访问pc6:
pc5不能访问pc6: