一、需求:
R3的测试地址与R4的测试地址连通
二、思路
- 首先配置各个端口的IP和R3与R4的测试地址
- 然后每个路由器手动获取剩余不在路由表例的IP
- 进行连接性测试
三、命令实例
1.R4
The device is running!
<Huawei>undo ter mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R4
[R4]int e0/0/0
[R4-Ethernet0/0/0]ip add 10.1.1.2 24
[R4-Ethernet0/0/0]q
[R4]int LoopBack 0
[R4-LoopBack0]ip add 192.168.1.10 24
[R4-LoopBack0]q
[R4]ip route-static 10.1.2.0 24 10.1.1.3 #手动获取10.1.2.0网段的IP
[R4]ip route-static 172.16.1.0 24 10.1.1.3 #手动获取172.16.1.0网段的IP
Info: The destination address and mask of the configured static route mismatched
, and the static route 172.16.1.0/24 was generated.
2.R2
The device is running!
<Huawei>undo ter mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn
[Huawei]sysname R2
[R2]int e0/0/0
[R2-Ethernet0/0/0]ip add 10.1.1.3 24
[R2-Ethernet0/0/0]int e0/0/1
[R2-Ethernet0/0/1]ip add 10.1.2.3 24
[R2-Ethernet0/0/1]q
[R2]ip route-static 192.168.1.0 24 10.1.1.2 #手动获取192.168.1.0网段的IP
Info: The destination address and mask of the configured static route mismatched
, and the static route 192.168.1.0/24 was generated.
[R2]ip route-static 172.16.1.0 24 10.1.2.4 #手动获取172.16.1.0网段的IP
Info: The destination address and mask of the configured static route mismatched
, and the static route 172.16.1.0/24 was generated.
R3
The device is running!
<Huawei>undo ter mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn R3
[R3]int e0/0/0
[R3-Ethernet0/0/0]ip add 10.1.2.4 24
[R3-Ethernet0/0/0]q
[R3]int loopb 0
[R3-LoopBack0]ip add 172.16.1.10 24
[R3-LoopBack0]q
[R3]ip route-static 10.1.1.0 24 10.1.2.3 #手动获取10.1.1.0网段的IP
[R3]ip route-static 192.168.1.0 24 10.1.2.3 #手动获取1192.168.1.0网段的IP
Info: The destination address and mask of the configured static route mismatched
, and the static route 192.168.1.0/24 was generated.
四、 连通性能测试
R4测试地址主动连接R3测试地址
[R4]ping -a 192.168.1.10 172.16.1.10
PING 172.16.1.10: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.10: bytes=56 Sequence=1 ttl=254 time=60 ms
Reply from 172.16.1.10: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 172.16.1.10: bytes=56 Sequence=3 ttl=254 time=60 ms
Reply from 172.16.1.10: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 172.16.1.10: bytes=56 Sequence=5 ttl=254 time=60 ms
--- 172.16.1.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/52/60 ms
R3测试地址主动连接R4测试地址
[R3]ping -a 172.16.1.10 192.168.1.10
PING 192.168.1.10: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.10: bytes=56 Sequence=1 ttl=254 time=100 ms
Reply from 192.168.1.10: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 192.168.1.10: bytes=56 Sequence=3 ttl=254 time=60 ms
Reply from 192.168.1.10: bytes=56 Sequence=4 ttl=254 time=60 ms
Reply from 192.168.1.10: bytes=56 Sequence=5 ttl=254 time=70 ms
--- 192.168.1.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/68/100 ms
五、总结
静态路由虽然不难,但是也是重要的知识点之一,需牢记,所以多做实验,熟记于心。