在R1上设置缺省,路由,而在R3和R4上设置静态路由,让12.1.1.0ping的通,23.1.1.0/24网段,24.1.1.0/24
在R1上操作 配置好ip 直接配置缺省路由,即默认路由,ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
最后跟的是接口ip 也可跟接口,或者接口+ip
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R1
[R1]undo i
[R1]undo in
[R1]undo inf
[R1]undo info-center en
[R1]undo info-center enable
Info: Information center is disabled.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip a
[R1-GigabitEthernet0/0/0]ip acc
[R1-GigabitEthernet0/0/0]ip accounting
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]ip ro
[R1]ip route-
[R1]ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
[R1]dis ip ro
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 12.1.1.2 GigabitEthernet
0/0/0
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R1]ping 23.1.1.3
PING 23.1.1.3: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 23.1.1.3 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[R1]ping 24.1.1.4
PING 24.1.1.4: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 24.1.1.4 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[R1]ping 23.1.1.3
PING 23.1.1.3: 56 data bytes, press CTRL_C to break
Reply from 23.1.1.3: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 23.1.1.3: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 23.1.1.3: bytes=56 Sequence=3 ttl=254 time=10 ms
Reply from 23.1.1.3: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 23.1.1.3: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 23.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/22/40 ms
[R1]ping 24.1.1.4
PING 24.1.1.4: 56 data bytes, press CTRL_C to break
Reply from 24.1.1.4: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 24.1.1.4: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 24.1.1.4: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 24.1.1.4: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 24.1.1.4: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 24.1.1.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms
在R2上操作,也就是配置各个接口的ip ,查看接口
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 23.1.1.2 24
Aug 11 2025 07:27:44-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 12.1.1.2 24
Aug 11 2025 07:28:04-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 24.1.1.2 24
[R2-GigabitEthernet0/0/2]
Aug 11 2025 07:28:40-08:00 R2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R2-GigabitEthernet0/0/2]q
[R2]un
[R2]undo in
[R2]undo info-center en
[R2]undo info-center enable
Info: Information center is disabled.
[R2]dis ip r
[R2]dis ip in
[R2]dis ip interface
GigabitEthernet0/0/0 current state : UP
Line protocol current state : UP
The Maximum Transmit Unit : 1500 bytes
input packets : 0, bytes : 0, multicasts : 0
output packets : 0, bytes : 0, multicasts : 0
Directed-broadcast packets:
received packets: 0, sent packets: 0
forwarded packets: 0, dropped packets: 0
ARP packet input number: 0
Request packet: 0
Reply packet: 0
Unknown packet: 0
Internet Address is 23.1.1.2/24
Broadcast address : 23.1.1.255
TTL being 1 packet number: 0
TTL invalid packet number: 0
ICMP packet input number: 0
Echo reply: 0
Unreachable: 0
Source quench: 0
Routing redirect: 0
Echo request: 0
Router advert: 0
Router solicit:
在R3上操作,配置ip 并且配置一个静态ip ip route-static 12.1.1.0 24 23.1.1.2
后面跟ip要到达的网段+掩码,和要到达的接口,即连接的接口ip
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R3
[R3]un
[R3]undo in
[R3]undo info-center en
Info: Information center is disabled.
[R3]undo info-center en
[R3]undo info-center enable
Info: Information center is disabled.
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.1.1.3 24
[R3-GigabitEthernet0/0/1]q
[R3]ip ro
[R3]ip route-
[R3]ip route-static 12.1.1.0 24 23.1.1.2
[R3]dis ip rp
[R3]dis ip ro
[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/24 Static 60 0 RD 23.1.1.2 GigabitEthernet
0/0/1
23.1.1.0/24 Direct 0 0 D 23.1.1.3 GigabitEthernet
0/0/1
23.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
在R4上操作设置ip ,静态路由,查看路由表
<Huawei>sy R3
^
Error:Too many parameters found at '^' position.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R4
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 24.1.1.4 24
Aug 11 2025 07:31:14-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4-GigabitEthernet0/0/1]q
[R4]un
[R4]undo in
[R4]undo info-center en
[R4]undo info-center enable
Info: Information center is disabled.
[R4]ip ro
[R4]ip route-
[R4]ip route-static 12.1.1.0 24 24.1.1.2
[R4]dis ip ro
[R4]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/24 Static 60 0 RD 24.1.1.2 GigabitEthernet
0/0/1
24.1.1.0/24 Direct 0 0 D 24.1.1.4 GigabitEthernet
0/0/1
24.1.1.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
24.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R4]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on