最近刚做完RIPv1的training,现在把重点总结下,已备日后复习。
RIP的4个计时器
更新(Update):每个更新之间的间隔时间,缺省30s
失效(Invalid ):经过该时间后可疑路由变为失效,标记possible down,缺省180s
保持(Holddown):Invalid超时后开始计时,缺省180s
清空(Flush ):经过这段时间后,可疑路由被移出路由表。缺省240s
计时器直观图示:
Update: |30s| >>>30S一次定期更新
Invalid: |----180s----| >>>180s没收到路由更新,标记路由possible down
Holddown: |-60s-|----|----| >>>默认180s,其实只有60s其作用
Flush: |----240s----------| >>>超时删除路由
经过测试,发现holddown没起到应有的作用,在holddown计时器开启的情况下,收到路由更新,router会直接结束holddown并把此路由加进去。
RIP计时器测试:
Topology:
―――
R1( S1/1: 192.168.4.9/30 )――�C( S1/1: 192.168.4.10/30 )R2( lo0: 192.168.5.1/24 )
1. 打开相关的debug
R2#debug ip routing
R2#debug ip rip
R2#debug ip rip da
R2#debug ip rip trig
R2#debug ip rip ev
2. 直接在R1的S1/1上使用访问列表,屏蔽R2发来的RIP更新
R2(config)#
R2(config)#access-list 101 deny udp any any eq rip
R2(config)#int s1/1
R2(config-if)#ip acce 101 in
R2(config-if)#
R2(config-if)#end
R2#
3. 在到达flush之前,更新路由表,确认holdtime作用
R2#sh ip route 192.168.5.0
Routing entry for 192.168.5.0/24
Known via "rip", distance 120, metric 1
Redistributing via rip
Last update from 192.168.4.10 on Serial1/1, 00:02:57 ago
Routing Descriptor Blocks:
* 192.168.4.10, from 192.168.4.10, 00:02:57 ago, via Serial1/1
Route metric is 1, traffic share count is 1
R2#
R2#
*Apr 5 18:10:27.014: RIP-DB: invalidated route of 192.168.5.0/24 via 192.168.4.10
!---180s没有收到路由,开启invalid计时
*Apr 5 18:10:27.018: RT: delete route to 192.168.5.0 via 192.168.4.10, rip metric [120/1]
*Apr 5 18:10:27.022: RT: no routes to 192.168.5.0, entering holddown
!---几乎同时holddown开始计时
*Apr 5 18:10:27.022: RIP-DB: Remove 192.168.5.0/24, (metric 4294967295) via 192.168.4.10, Serial1/1
*Apr 5 18:10:29.026: RIP: sending v1 flash update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 18:10:29.030: RIP: build flash update entries
*Apr 5 18:10:29.030: network 192.168.5.0 metric 16
!---发送即时更新,标记路由metric无穷大,并发布出去
*Apr 5 18:10:29.034: RIP: Update contains 1 routes
*Apr 5 18:10:29.034: RIP: Update queued
*Apr 5 18:10:29.038: RIP: Update sent via Serial1/1
*Apr 5 18:10:29.066: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 18:10:29.070: RIP: build update entries
*Apr 5 18:10:29.070: network 192.168.5.0 metric 16
*Apr 5 18:10:29.074: RIP: Update contains 1 routes
*Apr 5 18:10:29.074: RIP: Update queued
*Apr 5 18:10:29.078: RIP: Update sent via Serial1/1
R2#
R2#sh ip route 192.168.5.0
Routing entry for 192.168.5.0/24
Known via "rip", distance 120, metric 4294967295 (inaccessible)
Redistributing via rip
Last update from 192.168.4.10 on Serial1/1, 00:03:28 ago
Hold down timer expires in 0 secs
!---一直是“0”,没有任何改变,不知是不是bug
R2#
*Apr 5 18:10:58.506: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 18:10:58.510: RIP: build update entries
*Apr 5 18:10:58.514: network 192.168.5.0 metric 16
*Apr 5 18:10:58.514: RIP: Update contains 1 routes
*Apr 5 18:10:58.514: RIP: Update queued
*Apr 5 18:10:58.518: RIP: Update sent via Serial1/1ig ter
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#
R2(config)#
R2(config)#
R2(config)#int s1/1
R2(config-if)#no ip acce 101 in
R2(config-if)#end
R2#
R2#
*Apr 5 18:11:07.622: %SYS-5-CONFIG_I: Configured from console by console
*Apr 5 18:11:09.330: RIP: received v1 update from 192.168.4.10 on Serial1/1
*Apr 5 18:11:09.330: 192.168.5.0 in 1 hops
*Apr 5 18:11:09.334: RT: 192.168.5.0 came out of holddown
!---对比invalid时间(18:10:27),仍然在holddown期间,但是却接受了更新,holddown没作用
*Apr 5 18:11:09.334: RT: add 192.168.5.0/24 via 192.168.4.10, rip metric [120/1]
*Apr 5 18:11:09.338: RIP-DB: network_update with 192.168.5.0/24 succeeds
*Apr 5 18:11:09.342: RIP-DB: adding 192.168.5.0/0 (metric 1) via 192.168.4.10 on Serial1/1 to RIP database
*Apr 5 18:11:09.342: RIP-DB: add 192.168.5.0/24 (metric 1) via 192.168.4.10 on Serial1/1
*Apr 5 18:11:09.346: RIP: Update contains 1 routes
*Apr 5 18:11:11.346: RIP: sending v1 flash update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 18:11:11.350: RIP: build flash update entries - suppressing null update
*Apr 5 18:11:24.938: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 18:11:24.942: RIP: build update entries - suppressing null update
R2#
R2#
R2#sh 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
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.8 is directly connected, Serial1/1
R 192.168.5.0/24 [120/1] via 192.168.4.10, 00:00:25, Serial1/1
4. 等到flush超时,确认debug信息
*Apr 5 19:52:17.066: RIP-DB: invalidated route of 192.168.5.0/24 via 192.168.4.10
*Apr 5 19:52:17.070: RT: delete route to 192.168.5.0 via 192.168.4.10, rip metric [120/1]
*Apr 5 19:52:17.074: RT: no routes to 192.168.5.0, entering holddown
*Apr 5 19:52:17.074: RIP-DB: Remove 192.168.5.0/24, (metric 4294967295) via 192.168.4.10, Serial1/1
*Apr 5 19:52:19.078: RIP: sending v1 flash update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 19:52:19.082: RIP: build flash update entries
*Apr 5 19:52:19.082: network 192.168.5.0 metric 16
*Apr 5 19:52:19.086: RIP: Update contains 1 routes
*Apr 5 19:52:19.086: RIP: Update queued
*Apr 5 19:52:19.086: RIP: Update sent via Serial1/1
R2(config-if)
R2(config-if)#do sh 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
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.8 is directly connected, Serial1/1
R 192.168.5.0/24 is possibly down, routing via 192.168.4.10, Serial1/1
R2(config-if)#
R2(config-if)#
R2(config-if)#
R2(config-if)#
R2(config-if)#
R2(config-if)#do sh ip ri da
192.168.4.0/24 auto-summary
192.168.4.8/30 directly connected, Serial1/1
192.168.5.0/24 is possibly down
192.168.5.0/24 is possibly down
!---一个是汇总路由,一个是明细
R2(config-if)#
*Apr 5 19:52:49.054: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.4.9)
*Apr 5 19:52:49.058: RIP: build update entries
*Apr 5 19:52:49.058: network 192.168.5.0 metric 16
*Apr 5 19:52:49.062: RIP: Update contains 1 routes
*Apr 5 19:52:49.062: RIP: Update queued
*Apr 5 19:52:49.062: RIP: Update sent via Serial1/1
R2(config-if)#
R2(config-if)#
R2(config-if)#
*Apr 5 19:53:17.078: RIP-DB: garbage collect 192.168.5.0/24
*Apr 5 19:53:17.082: RIP-DB: garbage collect 192.168.5.0/24
*Apr 5 19:53:17.082: RT: delete network route to 192.168.5.0
!---删除路由,对比一下invalid时间(19:52:17)正好是60s
RIP的更新与接收规则
1. RIP更新规则
2. RIP接收规则
当router收到RIP的更新时,首先确认路由与接收端口是不是在同一网络。
如果不在会确认router是否可以从其他端口学到路由,如果有就丢弃RIP更新。
这里要加一句,当RIP更新的管理距离大于存在的路由时,他会丢弃,反之RIP更新会取代router的现有路由。
RIP问题实例
如果一台路由器中有大量接口(包括子接口)都是跑RIP(不论版本)的,那么会加大设备的负荷。如果其中一个端口有问题并flapping,那么更新会被发送到所有RIP激活的端口上,这样产生大量广播(或组播),严重消耗CPU(CPU处理路由更新)。
例如:
00:46:10: RIP: sending v1 flash update to 255.255.255.255 via Serial1/0.1 (10.1.1.1)
00:46:10: RIP: build flash update entries
00:46:10: network 172.30.0.0 metric 16
00:46:10: RIP: sending v1 flash update to 255.255.255.255 via Serial1/0.2 (10.1.2.1)
00:46:10: RIP: build flash update entries
00:46:10: network 172.30.0.0 metric 16
00:46:10: RIP: sending v1 flash update to 255.255.255.255 via Serial1/0.3 (10.1.3.1)
00:46:10: RIP: build flash update entries
00:46:10: network 172.30.0.0 metric 16
00:46:10: RIP: sending v1 flash update to 255.255.255.255 via Serial1/0.4 (172.31.1.1)
00:46:10: RIP: build flash update entries
00:46:10: network 172.30.0.0 metric 16