实验要求:
1、内网IP地址使用172.16.0.0/16分配、
2、sWa和sw2之间互为备份
3、VRRP/STP/VLAN/Eth-trunk均使用
4、所有pc均通过oHcP获取IP地址
5、ISP只能配置IP地址GE 0/0/5GE0/0/5
6、所有电脑可以正常访问IsP路由器环回
一、搭建拓扑
二、配置设备
1、ar2
<Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname AR2 [AR2]int g0/0/0 [AR2-GigabitEthernet0/0/0]ip address 10.0.0.2 255.255.255.252 Jun 25 2026 11:30:51-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. [AR2-GigabitEthernet0/0/0]undo shutdown Info: Interface GigabitEthernet0/0/0 is not shutdown. [AR2-GigabitEthernet0/0/0]q [AR2]int l0 [AR2-LoopBack0]ip address 2.2.2.2 255.255.255.255 [AR2-LoopBack0]q [AR2]ip route-static 172.16.0.0 255.255.0.0 10.0.0.12、ar1
<Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname r1 [r1]int g0/0/0 [r1-GigabitEthernet0/0/0]ip address 10.0.0.1 255.255.255.252 [r1-GigabitEthernet0/0/0]undo shutdown [r1-GigabitEthernet0/0/0]int g0/0/1 [r1-GigabitEthernet0/0/1]ip address 172.16.1.1 255.255.255.252 [r1-GigabitEthernet0/0/1]int g0/0/2 [r1-GigabitEthernet0/0/2]ip address 172.16.1.5 255.255.255.252 [r1-GigabitEthernet0/0/2]undo shutdown [r1-GigabitEthernet0/0/2]q [r1]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2 [r1]ospf 1 router-id 1.1.1.1 [r1-ospf-1]area 0.0.0.0 [r1-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.3 [r1-ospf-1-area-0.0.0.0]network 172.16.1.4 0.0.0.3 [r1-ospf-1-area-0.0.0.0]q [r1-ospf-1]default-route-advertise3、LSW1
<SW1>sys Enter system view, return user view with Ctrl+Z. [SW1]interface Eth-Trunk1 [SW1-Eth-Trunk1]description TO_LSW2 [SW1-Eth-Trunk1] port link-type trunk [SW1-Eth-Trunk1]port trunk allow-pass vlan 2 3 [SW1-Eth-Trunk1]interface GigabitEthernet0/0/1 [SW1-GigabitEthernet0/0/1]eth-trunk 1 [SW1-GigabitEthernet0/0/1]int g0/0/2 [SW1-GigabitEthernet0/0/2]eth-trunk 1 [SW1-GigabitEthernet0/0/2]int g0/0/3 [SW1-GigabitEthernet0/0/3]eth-trunk 1 [SW1-GigabitEthernet0/0/3]int g0/0/5 [SW1-GigabitEthernet0/0/5]port link-type access [SW1]vlan 100 [SW1-vlan100]q [SW1]interface Vlanif 100 [SW1-Vlanif100]ip address 172.16.1.2 255.255.255.252 [SW1-Vlanif100]q [SW1]int g0/0/4 [SW1-GigabitEthernet0/0/4]port link-type trunk [SW1-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3 [SW1-GigabitEthernet0/0/4]q [SW1]stp enable [SW1]stp mode mstp [SW1]stp region-configuration [SW1-mst-region]region-name NET [SW1-mst-region]q [SW1]stp region-configuration [SW1-mst-region]revision-level 1 [SW1-mst-region]instance 1 vlan 2 [SW1-mst-region]instance 2 vlan 3 [SW1-mst-region]active region-configuration [SW1-mst-region]q [SW1]stp instance 1 root primary [SW1]q <SW1>undo terminal monitor Info: Current terminal monitor is off. <SW1>sys Enter system view, return user view with Ctrl+Z. [SW1]stp instance 2 root secondary [SW1]interface Vlanif 2 [SW1-Vlanif2] ip address 172.16.2.1 255.255.255.0 [SW1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254 [SW1-Vlanif2]vrrp vrid 1 priority 120 [SW1-Vlanif2]vrrp vrid 1 preempt-mode timer delay 5 [SW1-Vlanif2]vrrp vrid 1 track interface GigabitEthernet0/0/5 reduced 30 [SW1-Vlanif2]dhcp select global Error: Please enable DHCP in the global view first. [SW1-Vlanif2]q [SW1]dhcp e [SW1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [SW1]interface Vlanif 2 [SW1-Vlanif2]dhcp select global [SW1-Vlanif2]interface Vlanif 3 [SW1-Vlanif3]ip address 172.16.3.1 255.255.255.0 [SW1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.3.254 [SW1-Vlanif3]vrrp vrid 2 priority 100 [SW1-Vlanif3]dhcp select global [SW1-Vlanif3]q [SW1]ip pool vlan2 Info:It's successful to create an IP address pool. [SW1-ip-pool-vlan2]gateway-list 172.16.2.254 [SW1-ip-pool-vlan2]network 172.16.2.0 mask 255.255.255.0 [SW1-ip-pool-vlan2]excluded-ip-address 172.16.2.254 Error:Only idle or expired IP address can be disabled. [SW1-ip-pool-vlan2]dns-list 8.8.8.8 [SW1-ip-pool-vlan2]q [SW1]ip pool vlan3 Info:It's successful to create an IP address pool. [SW1-ip-pool-vlan3]gateway-list 172.16.3.254 [SW1-ip-pool-vlan3]network 172.16.3.0 mask 255.255.255.0 [SW1-ip-pool-vlan3]excluded-ip-address 172.16.3.254 Error:Only idle or expired IP address can be disabled. [SW1-ip-pool-vlan3]dns-list 8.8.8.8 [SW1-ip-pool-vlan3]q [SW1]ospf 1 router-id 2.2.2.2 [SW1-ospf-1]area 0.0.0.0 [SW1-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.3 [SW1-ospf-1-area-0.0.0.0]network 172.16.2.0 0.0.0.255 [SW1-ospf-1-area-0.0.0.0]network 172.16.3.0 0.0.0.255 [SW1-ospf-1-area-0.0.0.0]q [SW1-ospf-1]q [SW1]4、LSW2
The device is running! <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysn [Huawei]sysname sw2 [sw2]interface Eth-Trunk1 [sw2-Eth-Trunk1] Jun 25 2026 12:26:30-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 4, the c hange loop count is 0, and the maximum number of records is 4095. [sw2-Eth-Trunk1]q [sw2]q <sw2>undo t m Info: Current terminal monitor is off. <sw2>sys Enter system view, return user view with Ctrl+Z. [sw2]description TO_LSW1 ^ Error: Unrecognized command found at '^' position. [sw2]interface Eth-Trunk1 [sw2-Eth-Trunk1]description TO_LSW1 [sw2-Eth-Trunk1]port link-type trunk [sw2-Eth-Trunk1]port trunk allow-pass vlan 2 3 [sw2-Eth-Trunk1]interface GigabitEthernet0/0/1 [sw2-GigabitEthernet0/0/1]eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [sw2-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2 [sw2-GigabitEthernet0/0/2]eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [sw2-GigabitEthernet0/0/2]interface GigabitEthernet0/0/3 [sw2-GigabitEthernet0/0/3]eth-trunk 1 Info: This operation may take a few seconds. Please wait for a moment...done. [sw2-GigabitEthernet0/0/3]interface GigabitEthernet0/0/5 [sw2-GigabitEthernet0/0/5]port link-type access [sw2-GigabitEthernet0/0/5] port default vlan 200 Error: The VLAN does not exist. [sw2-GigabitEthernet0/0/5]q [sw2]vlan 200 [sw2-vlan200]q [sw2]int g0/0/5 [sw2-GigabitEthernet0/0/5]port default vlan 200 [sw2-GigabitEthernet0/0/5]interface Vlanif 200 [sw2-Vlanif200] ip address 172.16.1.6 255.255.255.252 [sw2-Vlanif200]interface GigabitEthernet0/0/4 [sw2-GigabitEthernet0/0/4] port link-type trunk [sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 3 [sw2-GigabitEthernet0/0/4]q [sw2]stp e [sw2]stp edged-port ^ Error:Incomplete command found at '^' position. [sw2]stp edged-port [sw2]stp edged-port [sw2]stp ena [sw2]stp enable [sw2]stp mod [sw2]stp mode ms [sw2]stp mode mstp [sw2]stp region-configuration [sw2-mst-region]reg [sw2-mst-region]region-name NET [sw2-mst-region]rev [sw2-mst-region]revision-level 1 [sw2-mst-region]ins [sw2-mst-region]instance 1 v 2 [sw2-mst-region]ins [sw2-mst-region]instance 2 v 3 [sw2-mst-region]actl [sw2-mst-region]ac [sw2-mst-region]active [sw2-mst-region]active re [sw2-mst-region]active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [sw2-mst-region]q [sw2]stp is [sw2]stp ins [sw2]stp instance 1 r [sw2]stp instance 1 root se [sw2]stp instance 1 root secondary [sw2]stp ins [sw2]stp instance 2 r [sw2]stp instance 2 root p [sw2]stp instance 2 root primary [sw2]int [sw2]interface v [sw2]interface Vlanif 2 Error: The VLAN does not exist. [sw2]q <sw2>sys Enter system view, return user view with Ctrl+Z. [sw2]vla [sw2]vlan b [sw2]vlan batch 2 3 200 Info: This operation may take a few seconds. Please wait for a moment...done. [sw2]int [sw2]interface v [sw2]interface Vlanif 2 [sw2-Vlanif2]ip address 172.16.2.2 255.255.255.0 [sw2-Vlanif2] vrrp vrid 1 virtual-ip 172.16.2.254 [sw2-Vlanif2]vrrp vrid 1 priority 100 [sw2-Vlanif2]dhcp select global Error: Please enable DHCP in the global view first. [sw2-Vlanif2]q [sw2]dhcp ^ Error:Incomplete command found at '^' position. [sw2]dhcp [sw2]dhcp-snooping [sw2]dhcp en [sw2]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [sw2]dhcp select global ^ Error: Unrecognized command found at '^' position. [sw2]int v [sw2]int Vlanif 2 [sw2-Vlanif2]dhcp select global [sw2-Vlanif2]q [sw2]ip rool vlan2 ^ Error: Unrecognized command found at '^' position. [sw2]ip pool vlan2 Info:It's successful to create an IP address pool. [sw2-ip-pool-vlan2]ga [sw2-ip-pool-vlan2]gateway-list 172.16.2.254 [sw2-ip-pool-vlan2]net [sw2-ip-pool-vlan2]network 172.16.2.0 mask 255.255.255.0 [sw2-ip-pool-vlan2]dns [sw2-ip-pool-vlan2]dns-list 8.8.8.8 [sw2-ip-pool-vlan2]q [sw2]ospf 1r [sw2]ospf 1 r [sw2]ospf 1 router-id 3.3.3.3 [sw2-ospf-1]ar [sw2-ospf-1]area 0.0.0.0 [sw2-ospf-1-area-0.0.0.0]ney [sw2-ospf-1-area-0.0.0.0]net [sw2-ospf-1-area-0.0.0.0]network 172.16.1.4 0.0.0.3 [sw2-ospf-1-area-0.0.0.0]network 172.16.2.0 0.0.0.255 [sw2-ospf-1-area-0.0.0.0]network 172.16.3.0 0.0.0.255 [sw2-ospf-1-area-0.0.0.0]q [sw2-ospf-1]q [sw2]q <sw2>save The current configuration will be written to the device. Are you sure to continue?[Y/N]y Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: <sw2> <sw2>LSW3
<Huawei> <Huawei>SYS Enter system view, return user view with Ctrl+Z. [Huawei]SYSn [Huawei]sysname sw3 [sw3] Jun 25 2026 12:37:54-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 4, the c hange loop count is 0, and the maximum number of records is 4095.v ^ Error:Ambiguous command found at '^' position. [sw3] [sw3]q <sw3> Jun 25 2026 12:38:00-08:00 sw3 %%01PHY/1/PHY(l)[0]: GigabitEthernet0/0/4: cha nge status to downun Jun 25 2026 12:38:01-08:00 sw3 %%01PHY/1/PHY(l)[1]: GigabitEthernet0/0/4: cha nge status to up ^ Error:Ambiguous command found at '^' position. <sw3>undo t m Info: Current terminal monitor is off. <sw3>sys Enter system view, return user view with Ctrl+Z. [sw3]vl [sw3]vlan b 2 3 Info: This operation may take a few seconds. Please wait for a moment...done. [sw3]int g0/0/1 [sw3-GigabitEthernet0/0/1]description TO_LSW1 [sw3-GigabitEthernet0/0/1]port link-type trunk [sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3 [sw3-GigabitEthernet0/0/1]int g0/0/3 [sw3-GigabitEthernet0/0/3]description TO_PC1 [sw3-GigabitEthernet0/0/3]port link-type access [sw3-GigabitEthernet0/0/3]port default vlan 2 [sw3-GigabitEthernet0/0/3]stp edged-port enable [sw3-GigabitEthernet0/0/3]interface GigabitEthernet0/0/4 [sw3-GigabitEthernet0/0/4]description TO_PC2 [sw3-GigabitEthernet0/0/4] port link-type access [sw3-GigabitEthernet0/0/4]port default vlan 3 [sw3-GigabitEthernet0/0/4]stp edged-port enable [sw3-GigabitEthernet0/0/4]q [sw3]stp enable [sw3]stp mode mstp [sw3]stp region-configuration [sw3-mst-region]region-name NET [sw3-mst-region] revision-level 1 [sw3-mst-region] instance 1 vlan 2 [sw3-mst-region] instance 2 vlan 3 [sw3-mst-region] active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [sw3-mst-region]q [sw3]q <sw3>sys Enter system view, return user view with Ctrl+Z. [sw3]sys [sw3]sysname LSW3LSW4
<Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sys LSW4 [LSW4] Jun 25 2026 12:41:22-08:00 LSW4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.2 5.191.3.1 configurations have been changed. The current change number is 4, the change loop count is 0, and the maximum number of records is 4095. [LSW4]quit <LSW4>undo t m Info: Current terminal monitor is off. <LSW4>int g0/0/1 ^ Error: Unrecognized command found at '^' position. <LSW4>sys Enter system view, return user view with Ctrl+Z. [LSW4]vlan b 2 3 Info: This operation may take a few seconds. Please wait for a moment...done. [LSW4]int g0/0/1 [LSW4-GigabitEthernet0/0/1]de [LSW4-GigabitEthernet0/0/1]des [LSW4-GigabitEthernet0/0/1]description to [LSW4-GigabitEthernet0/0/1]description to_LSW2 [LSW4-GigabitEthernet0/0/1]pr [LSW4-GigabitEthernet0/0/1]protocol-vlan [LSW4-GigabitEthernet0/0/1]port link-type trunk [LSW4-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 3 [LSW4-GigabitEthernet0/0/1]interface GigabitEthernet0/0/3 [LSW4-GigabitEthernet0/0/3]description TO_PC3 [LSW4-GigabitEthernet0/0/3] port link-type access [LSW4-GigabitEthernet0/0/3] port default vlan 2 [LSW4-GigabitEthernet0/0/3] stp edged-port enable [LSW4-GigabitEthernet0/0/3]interface GigabitEthernet0/0/4 [LSW4-GigabitEthernet0/0/4]description TO_PC4 [LSW4-GigabitEthernet0/0/4] port link-type access [LSW4-GigabitEthernet0/0/4] port default vlan 3 [LSW4-GigabitEthernet0/0/4] stp edged-port enable [LSW4-GigabitEthernet0/0/4]q [LSW4]stp en [LSW4]stp enable [LSW4]stp mode mstp [LSW4]stp region-configuration [LSW4-mst-region]region-name NET [LSW4-mst-region] revision-level 1 [LSW4-mst-region] instance 1 vlan 2 [LSW4-mst-region] instance 2 vlan 3 [LSW4-mst-region] active region-configuration Info: This operation may take a few seconds. Please wait for a moment...done. [LSW4-mst-region] [LSW4-mst-region] [LSW4-mst-region]q [LSW4]q <LSW4>save The current configuration will be written to the device. Are you sure to continue?[Y/N]y Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: Now saving the current configuration to the slot 0. Save the configuration successfully. <LSW4> <LSW4>