目录
一、实验拓扑图:
二、实验要求:
三、实验思路:
四、实验步骤:
1、在交换机SW1,SW2,SW3配置VLAN和各个接口对应类型的配置
2、在路由器上面配置DHCP服务
一、实验拓扑图:
二、实验要求:
1、PC1 和 PC3所在的接口为access; 属于VLAN 2;
PC2/PC4/PC5/PC6处于同一网段’其中PC2可以访问PC4/PC5/PC6;
PC4可以访问PC6;PC5不能访问PC6;
- PC1/PC3与PC2/PC4/PC5/PC6不在同一个网段;
- 所有PC通过DHCP获取IP地址,且PC1/PC3可以正常访问PC2/PC4/PC5/PC6;
三、实验思路:
- 先给交换机配置相应类型的接口配置
- 再在路由器配置IP地址和DHCP的配置
四、实验步骤:
1、在交换机SW1,SW2,SW3配置VLAN和各个接口对应类型的配置
SW1:
<Huawei>sys[Huawei]sysn SW1[SW1]vlan batch 2 to 6 #批量创建VLAN 2到VLAN 6[SW1]int g0/0/1[SW1-GigabitEthernet0/0/1]port link-type access[SW1-GigabitEthernet0/0/1]port default vlan 2[SW1-GigabitEthernet0/0/1]int g0/0/2[SW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3[SW1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6 #将GigabitEthernet0/0/2接口的未标记(Untagged)VLAN设置为VLAN 3、VLAN 4、VLAN 5和VLAN 6。[SW1-GigabitEthernet0/0/2]int g0/0/3[SW1-GigabitEthernet0/0/3]port link-type trunk[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all #允许所有VLAN通过GigabitEthernet0/0/3接口。[SW1-GigabitEthernet0/0/3]int g0/0/4[SW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6 #GigabitEthernet0/0/4接口的未标记(Untagged)VLAN设置为VLAN 3、VLAN 4、VLAN 5和VLAN 6。[SW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2 #将GigabitEthernet0/0/4接口的标记(Tagged)VLAN设置为VLAN 2。[SW1-GigabitEthernet0/0/4]q[SW1]dis port vlan active #显示当前激活的端口和所属的VLAN信息
SW2:
<Huawei>sysEnter system view, return user view with Ctrl+Z.[Huawei]sysn SW2[SW2]vlan batch 2 to 6[SW2]int g0/0/1[SW2-GigabitEthernet0/0/1]port link-type access[SW2-GigabitEthernet0/0/1]port default vlan 2[SW2-GigabitEthernet0/0/1]int g0/0/2[SW2-GigabitEthernet0/0/2]port hybrid pvid vlan 4[SW2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6[SW2-GigabitEthernet0/0/2]int g0/0/3[SW2-GigabitEthernet0/0/3]port link-type trunk[SW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all[SW2-GigabitEthernet0/0/3]int g0/0/4[SW2-GigabitEthernet0/0/4]port link-type trunk[SW2-GigabitEthernet0/0/4]port trunk allow-pass vlan all[SW2-GigabitEthernet0/0/4]q[SW2]dis port vlan active
SW3:
[Huawei]sysn SW3[SW3]vlan batch 2 to 6[SW3]int g0/0/1[SW3-GigabitEthernet0/0/1]port hybrid pvid vlan 5[SW3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5[SW3-GigabitEthernet0/0/1]int g0/0/2[SW3-GigabitEthernet0/0/2]port hybrid pvid vlan 6[SW3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 6[SW3-GigabitEthernet0/0/2]q[SW3]dis port vlan active
2、在路由器上面配置DHCP服务
R1:
<Huawei>sys[Huawei]sysn R1[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 #接口上设置VLAN终结,指定VLAN ID为2[R1-GigabitEthernet0/0/0.1]arp broadcast enable #启用GigabitEthernet0/0/0.1接口的ARP广播功能[R1-GigabitEthernet0/0/0.1]q[R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.2.1 24[R1-GigabitEthernet0/0/0]q[R1]dhcp enable[R1]ip pool aa[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 8.8.8.8[R1-ip-pool-aa]q[R1]ip pool bb[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 8.8.8.8[R1-ip-pool-bb]q[R1]int g0/0/0.1[R1-GigabitEthernet0/0/0.1]dhcp select global #为GigabitEthernet0/0/0.1接口选择全局的DHCP服务。[R1-GigabitEthernet0/0/0.1]int g0/0/0[R1-GigabitEthernet0/0/0]dhcp select global #为GigabitEthernet0/0/0接口选择全局的DHCP服务。