实验要求
1、全网可达;
2、使用DHCP获取IP地址;
一.给设备改好名字
<Huawei>system-view
[Huawei]sysname sw1
[Huawei]sysname sw2
[Huawei]sysname sw3
[Huawei]sysname R1
二.创建vlan
[SW1]vlan 2
[SW1]vlan3
[SW2]vlan 2
[SW2]vlan3
[SW3]vlan 2
[SW3]vlan3
三.接口配备
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 2
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 3
[SW1-Ethernet0/0/3]quit
[SW2]int e0/0/3
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default vlan 2
[SW2-Ethernet0/0/3]int e0/0/4
[SW2-Ethernet0/0/4]port link-type access
[SW2-Ethernet0/0/4]port default vlan 3
[SW3]int e0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 2
[sw3-Ethernet0/0/2]int e0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port default vlan 3
四.放行VLAN
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]port link-type trunk
[SW1-Ethernet0/0/1]port trunk allow-pass vlan all
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]port link-type trunk
[SW2-Ethernet0/0/2]port trunk allow-pass vlan all
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]port trunk allow-pass vlan all
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan all
五.路由器配备
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]ip add 192.168.1.254 24
[R1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]ip add 192.168.2.254 24
[R1]int g0/0/1.1
[R1-GigabitEthernet0/0/1.1]dot1q termination vid 2
[R1-GigabitEthernet0/0/1.1]arp broadcast enable
[R1-GigabitEthernet0/0/1.1]ip add 192.168.3.254 24
[R1-GigabitEthernet0/0/1.1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dot1q termination vid 3
[R1-GigabitEthernet0/0/1.2]arp broadcast enable
[R1-GigabitEthernet0/0/1.2]ip add 192.168.4.254 24
六.配置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 114.114.114.114 8.8.8.8
[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 114.114.114.114 8.8.8.8
[R1]ip pool cc
[R1-ip-pool-bb]network 192.168.3.0 mask 24
[R1-ip-pool-bb]gateway-list 192.168.3.254
[R1-ip-pool-bb]dns-list 114.114.114.114 8.8.8.8
[R1]ip pool dd
[R1-ip-pool-bb]network 192.168.4.0 mask 24
[R1-ip-pool-bb]gateway-list 192.168.4.254
[R1-ip-pool-bb]dns-list 114.114.114.114 8.8.8.8
[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dhcp select global
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dhcp select global
[R1-GigabitEthernet0/0/0.2]int g0/0/1.1
[R1-GigabitEthernet0/0/1.1]dhcp select global
[R1-GigabitEthernet0/0/1.1]int g0/0/1.2
[R1-GigabitEthernet0/0/1.2]dhcp select global
最后测试