标签:管理员 5.0 hang been down tables enc change 路由表
什么是静态路由?
静态路由是指由用户或网络管理员手工配置的路由信息。当网络的拓扑结构或链路的状态发生变化时,网络管理员需要手工去修改路由表中相关的静态路由信息。静态路由信息在缺省情况下是私有的,不会传递给其他的路由器。
实验环境:华为模拟器eNSP
现在有这样一个拓扑图:
很明显路由器R1
和R3
之间无法通信,ping
一下试试。
[R1]ping 192.168.2.2
PING 192.168.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
全部超时,现在通过添加静态路由使R1
和R3
之间相互通信,先来看一下R1
的路由表:
<R1>dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
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
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Ethernet0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0
现在只有回环接口和本地IP,现在来给他添加去往R3的静态路由:
[R1]ip route-static 192.168.2.0 255.255.255.0 192.168.1.2
Jul 25 2018 20:37:00-08:00 R1 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 3, the ch
ange loop count is 0, and the maximum number of records is 4095.
查看一下路由表:
<R1>dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
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
192.168.1.0/24 Direct 0 0 D 192.168.1.1 Ethernet0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0
192.168.2.0/24 Static 60 0 RD 192.168.1.2 Ethernet0/0/0
发现路由表中已经加进了去往R3
的静态路由,现在来ping
一下R3
。
<R1>ping 192.168.2.2
PING 192.168.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
看到无法ping
通,因为现在只有去的路由,但是没有回来的路由,也就是说ping
的数据包现在只知道怎么去,但是不知道怎么回来,那么现在来给他添加回程路由。
回程路由配在路由器R3
上面。
[R3]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1
Jul 25 2018 20:43:10-08:00 R3 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 3, the ch
ange loop count is 0, and the maximum number of records is 4095.
现在再去R1
上面ping
一下R3
试试。
<R1>ping 192.168.2.2
PING 192.168.2.2: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.2: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 192.168.2.2: bytes=56 Sequence=2 ttl=254 time=60 ms
Reply from 192.168.2.2: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.2.2: bytes=56 Sequence=4 ttl=254 time=90 ms
Reply from 192.168.2.2: bytes=56 Sequence=5 ttl=254 time=100 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/64/100 ms
发现可以ping
通了,说明静态路由添加成功。
配置静态路由的命令是ip route-static 要去网段 要去网段的子网掩码 下一跳
。
标签:管理员 5.0 hang been down tables enc change 路由表
原文地址:https://www.cnblogs.com/Timesi/p/9368283.html