--LO1----R6---S1/2-------------S1/5------R7------LO1
192.168.6.1 192.168.67.1 192.168.67.2 192.168.7.1
R6(config)#ip route 192.168.7.0 255.255.255.0 s1/2 192.168.67.2 name san tag 5
目的地址 掩码 出口 下一跳 下一跳名称 标记该路由
R6(config)#ip route 192.168.7.0 255.255.255.0 Loopback1 name li ( 这条是无效的。)
相同目的地址,两条路由。
对于静态路由,路由器是要检测该路由的条目的有效性的,正常情况下路由器对静态路由的下一跳有效性的检查是一分钟,在12.3(10)以后增加了下面的命令可以对此时间进行调整Router(config)#ip route static adjust-time 30。对静态路由打tag用于路由再发布时的区分。
这个时候在路由表中查看:
R6(config)#do show ip route static
S 192.168.7.0/24 [1/0] via 192.168.67.2, Serial1/2
is directly connected, Loopback1 -----这条不正确的路由会消失的
如下:现象是到相同目的的静态路由都消失了,
R6#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.6.0/24 is directly connected, Loopback1
C 192.168.67.0/24 is directly connected, Serial1/2
R6#
刷新后又都重新出现。
R6#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.6.0/24 is directly connected, Loopback1
C 192.168.67.0/24 is directly connected, Serial1/2
S 192.168.7.0/24 [1/0] via 192.168.67.2, Serial1/2
is directly connected, Loopback1
修改对静态路由下一跳有效性检测时间:
R6(config)#ip route static adjust-time ?
<1-60> Adjustment time in seconds
R6(config)#ip route static adjust-time 35
去掉上面的两条静态路由。
no ip route 192.168.7.0 255.255.255.0 s1/2 192.168.67.2 name san tag 5
no ip route 192.168.7.0 255.255.255.0 lo1 name li
R6(config)#do show ip route static
R6(config)#
现在路由表中,已经没有静态路由了。
现在我确定这个路由没问题,想省却检查静态路由下一跳有效性的步骤,提高路由器的工作效率。
ip route 192.168.7.0 255.255.255.0 s1/2 192.168.67.2 name wang tag 51 66 permanent
permanent选项可以使此条目一直存在于路由表中,而不管下一跳的可达性
R6(config)#do show ip route static
S 192.168.7.0/24 [66/0] via 192.168.67.2, Serial1/2
静态路由的基本命令,常用的写到这里吧。
监听一个接口,当接口down之后,才启动该路由
R6(config)#track 8 int lo1 line-protocol
R6(config-track)#delay down 5 up 30
R6(config-track)#exit
R6(config)#ip route 192.168.7.0 255.255.255.0 s1/2 track 8
路由表变动统计:
R6(config)#ip route profile 启动路由统计
R6#show ip route profile
IP routing table change statistics:
Frequency of changes in a 5 second sampling interval
-------------------------------------------------------------
Change/ Fwd-path Prefix Nexthop Pathcount Prefix
interval change add change change refresh
-------------------------------------------------------------
0 0 0 0 0 0
1 0 0 0 0 0
2 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 0 0 0
10 0 0 0 0 0
15 0 0 0 0 0
20 0 0 0 0 0
25 0 0 0 0 0
30 0 0 0 0 0
55 0 0 0 0 0
80 0 0 0 0 0
105 0 0 0 0 0
130 0 0 0 0 0
155 0 0 0 0 0
280 0 0 0 0 0
405 0 0 0 0 0
-------------------------------------------------------------
Change/ Fwd-path Prefix Nexthop Pathcount Prefix
interval change add change change refresh
-------------------------------------------------------------
530 0 0 0 0 0
655 0 0 0 0 0
780 0 0 0 0 0
1405 0 0 0 0 0
2030 0 0 0 0 0
2655 0 0 0 0 0
3280 0 0 0 0 0
3905 0 0 0 0 0
7030 0 0 0 0 0
10155 0 0 0 0 0
13280 0 0 0 0 0
Overflow 0 0 0 0 0
R6#
其实这个我看不太懂,请高手给指点下。