实验思路
1.配置交换机
创建vlan
更改交换机的接口链路类型
配置trunk干道,放通vlan
2.配置路由器
配置子接口
配置DHCP服务
在子接口下放DHCP服务
3.实验步骤
1.创建vlan,划分接口
<sw1>undo terminal monitor
<sw1>sys
[sw1]vlan 2
[sw1-vlan2]quit
[sw1]vlan 3
[sw1-vlan3]quit
[sw1]int g 0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 2
[sw1-GigabitEthernet0/0/2]quit
[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port default vlan 3
[sw1-GigabitEthernet0/0/3]quit
放行VLAN
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type truk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[sw1-GigabitEthernet0/0/1]quit
创。划
<sw2>undo terminal monitor
<sw2>sys
[sw2]vlan 2
[sw2-vlan2]quit
[sw2]vlan 3
[sw2-vlan3]quit
[sw2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]port default vlan 2
[sw2-GigabitEthernet0/0/3]quit
[sw2]int g0/0/3
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/3]port default vlan 2
[sw2-GigabitEthernet0/0/3]quit
[sw2]int g0/0/4
[sw2-GigabitEthernet0/0/4]port link-type access
[sw2-GigabitEthernet0/0/4]port default vlan 3
[sw2-GigabitEthernet0/0/4]quit
放行VLAN
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]port link-type trunk
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3
[sw2-GigabitEthernet0/0/2]quit
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[sw2-GigabitEthernet0/0/1]quit
给老子检查!!!查!!!
display port vlan active
创,划分
<sw3>undo terminal monitor
<sw3>sys
[sw3]vlan 2
[sw3-vlan2]vlan 3
[sw3-vlan3]quit
[sw3]int g0/0/2
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/2]port default vlan 2
[sw3-GigabitEthernet0/0/2]quit
[sw3]int g0/0/3
[sw3-GigabitEthernet0/0/3]port link-type access
[sw3-GigabitEthernet0/0/3]port default vlan 3
[sw3-GigabitEthernet0/0/3]quit
放行VLAN
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3
[sw3-GigabitEthernet0/0/1]quit
[sw3]display port vlan active(检查!!!)
配置路由子接口
[Huawei]sysname r1
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]ip add 192.168.1.254 24
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.2]arp broadcast enable
[r1-GigabitEthernet0/0/0.2]quit
[r1]int
[r1]interface g0/0/0.3
[r1-GigabitEthernet0/0/0.3]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.3]arp broadcast enable
[r1-GigabitEthernet0/0/0.3]quit
[r1]interface GigabitEthernet 0/0/1.2
[r1-GigabitEthernet0/0/1.2]ip add 192.168.1.254 24
[r1-GigabitEthernet0/0/1.2]dot1q termination vid 2
[r1-GigabitEthernet0/0/1.2]arp broadcast enable
[r1-GigabitEthernet0/0/1.2]quit
[r1]int g 0/0/1.3
[r1-GigabitEthernet0/0/1.3]dot1q termination vid 3
[r1-GigabitEthernet0/0/1.3]arp broadcast enable
[r1-GigabitEthernet0/0/1.3]quit
配置DHCP
[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.254
[r1-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
[r1-ip-pool-aa]quit
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global
[r1-GigabitEthernet0/0/0.2]quit
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]ip pool aa
[r1-ip-pool-aa]network 192.168.1.0 mask 24
[r1-ip-pool-aa]quit
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global
[r1-GigabitEthernet0/0/0.2]quit
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global
[r1-GigabitEthernet0/0/0.2]quit
[r1]ip pool bb
[r1-ip-pool-bb]network 192.168.2.0 mask 24
[r1-ip-pool-bb]gateway-list 192.168.2.254
[r1-ip-pool-bb]dns-list 8.8.8.8 114.114.114.114
[r1-ip-pool-bb]quit
[r1]int g0/0/0.3
[r1-GigabitEthernet0/0/0.3]dhcp select global
[r1-GigabitEthernet0/0/0.3]quit
[r1]ip pool cc
[r1-ip-pool-cc]network 192.168.3.0 mask 24
[r1-ip-pool-cc]gateway-list 19a2.168.3.254
[r1-ip-pool-cc]gateway-list 192.168.3.254
[r1-ip-pool-cc]dns-list 8.8.8.8 114.114.114.114
[r1-ip-pool-cc]quit
[r1]int g0/0/1.2
[r1-GigabitEthernet0/0/1.2]dhcp select global
[r1-GigabitEthernet0/0/1.2]quit
[r1]ip pool dd
[r1-ip-pool-dd]network 192.168.4.0 mask 24
[r1-ip-pool-dd]dns-list 8.8.8.8 114.114.114.114
[r1-ip-pool-dd]quit
[r1]int g 0/0/1.3
[r1-GigabitEthernet0/0/1.3]dhcp select global
[r1-GigabitEthernet0/0/1.3]quit
测试