实验7-1 : RIPV1
实验目的通过本实验可以掌握:1. 在路由器上启动RIPv1 路由进程2. 启用参与路由协议的接口,并且通告网络3. 理解路由表的含义4. 查看和调试RIPv1 路由协议相关信息 实验拓扑
实验步骤
n 步骤1:配置路由器R2router(config)#host R2R2(config)#no ip do loR2(config)#int s1/0R2(config-if)#ip add 192.168.12.2 255.255.255.0R2(config-if)#no shR2(config-if)#int lo0R2(config-if)#ip add 2.2.2.2 255.255.255.0R2(config)#router ripR2(config-router)#version 1R2(config-router)#network 2.0.0.0R2(config-router)#network 192.168.12.0R2(config-router)#passive-interface lo0n 步骤2:配置路由器R1router(config)#host R1R1(config)#no ip do loR1(config)#int s1/0R1(config-if)#ip add 192.168.12.1 255.255.255.0R1(config-if)#clock rate 64000R1(config-if)#no shR1(config)#int s1/1R1(config-if)#ip add 192.168.13.1 255.255.255.0R1(config-if)#clock rate 64000R1(config-if)#no shR1(config-if)#int lo0R1(config-if)#ip add 1.1.1.1 255.255.255.0R1(config)#router ripR1(config-router)#version 1R1(config-router)#network 1.0.0.0R1(config-router)#network 192.168.12.0R1(config-router)#network 192.168.13.0R1(config-router)#passive-interface lo0 n 步骤3:配置路由器R3router(config)#host R3R3(config)#no ip do loR3(config)#int s1/0R3(config-if)#ip add 192.168.13.3 255.255.255.0R3(config-if)#no shR3(config-if)#int lo0R3(config-if)#ip add 3.3.3.3 255.255.255.0R3(config)#router ripR3(config-router)#version 1R3(config-router)#network 3.3.3.0R3(config-router)#network 192.168.13.0R3(config-router)#passive-interface lo0 实验调试n R1#show ip routeCodes: 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 routeGateway of last resort is not setC 192.168.12.0/24 is directly connected, Serial1/0 1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback0C 192.168.13.0/24 is directly connected, Serial1/1R 2.0.0.0/8 [120/1] via 192.168.12.2, 00:00:08, Serial1/0R 3.0.0.0/8 [120/1] via 192.168.13.3, 00:00:08, Serial1/1n R1#debug ip ripRIP protocol debugging is on*Mar 1 00:39:09.591: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.13.1)*Mar 1 00:39:09.595: RIP: build update entries*Mar 1 00:39:09.595: network 1.0.0.0 metric 1*Mar 1 00:39:09.599: network 2.0.0.0 metric 1*Mar 1 00:39:09.599: network 192.168.12.0 metric 1*Mar 1 00:39:17.423: RIP: received v1 update from 192.168.13.3 on Serial1/1*Mar 1 00:39:17.427: 3.0.0.0 in 1 hops*Mar 1 00:39:19.327: RIP: received v1 update from 192.168.12.2 on Serial1/0*Mar 1 00:39:19.331: 2.0.0.0 in 1 hops*Mar 1 00:39:22.967: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.12.1)*Mar 1 00:39:39.011: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.13.1)【测试】R2(config)#router ripR2(config-router)#passive-interface s1/0R2#debug ip rip查看R2能否接收到来自R1的rip更新通告R1#debug ip rip查看R1能否接收到来自s1/0的rip更新通告R2(config)#router ripR2(config-router)#neighbor 192.168.12.1R1#debug ip rip查看R1能否接收到来自s1/0的rip更新通告【提示】被动接口只能接收路由更新,不能以广播或组播方式发送更新,但是可以以单播的方式发送更新,配置单播更新的命令如下:R2(config)#router ripR2(config-router)#passive-interface s1/0R2(config-router)#neighbor 192.168.12.1
实验7-2 RIPV2
实验目的通过本实验可以掌握:(1)在路由器上启动RIPv2 路由进程(2)启用参与路由协议的接口,并且通告网络(3)auto-summary 的开启和关闭(4)查看和调试RIPv2 路由协议相关信息 实验拓扑
实验步骤
n 路由器R2的主要配置R2(config)#router ripR2(config-router)#version 2R2(config-router)#no auto-summaryR2(config-router)#network 2.2.2.0R2(config-router)#network 192.168.12.0n 路由器R1的主要配置R1(config)#router ripR1(config-router)#version 2R1(config-router)#no auto-summaryR1(config-router)#network 192.168.12.0R1(config-router)#network 192.168.13.0R1(config-router)#network 1.1.1.0n 路由器R3的主要配置R3(config)#router ripR3(config-router)#version 2R3(config-router)#no auto-summaryR3(config-router)#network 192.168.13.0R3(config-router)#network 3.3.3.0 实验调试n R1#show ip routeCodes: 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 routeGateway of last resort is not setC 192.168.12.0/24 is directly connected, Serial1/0 1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback0C 192.168.13.0/24 is directly connected, Serial1/1 2.0.0.0/24 is subnetted, 1 subnetsR 2.2.2.0 [120/1] via 192.168.12.2, 00:00:28, Serial1/0 3.0.0.0/24 is subnetted, 1 subnetsR 3.3.3.0 [120/1] via 192.168.13.3, 00:00:07, Serial1/1以上输出表明路由器R1 学到了2条RIP 路由,其中路由条目”R 3.3.3.0 [120/1] via 192.168.13.3, 00:00:07, Serial1/1”含义如下:n R:路由条目是通过RIP 路由协议学习来的;n 3.3.3.0/24:目的网络;n 120:RIP 路由协议的默认管理距离;n 1: 度量值,从路由器R1 到达网络3.3.3.0/24 的度量值为1 跳;n 192.168.13.3:下一跳地址;n 00:00:07:距离下一次更新还有23(30-7)秒;n Serial1/0:接收该路由条目的本路由器的接口【提示】可以看到auto-summary关闭后,通过RIPv2学到的不再是汇总到major-net的路由 n R1#show ip protocol //查看路由器协议配置和统计信息 Routing Protocol is "rip" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Sending updates every 30 seconds, next due in 24 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Redistributing: rip Default version control: send version 2, receive version 2 Interface Send Recv Triggered RIP Key-chain Serial1/0 2 2 Serial1/1 2 2 Loopback0 2 2 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 1.0.0.0 192.168.12.0 192.168.13.0 Routing Information Sources: Gateway Distance Last Update 192.168.13.3 120 00:00:04 192.168.12.2 120 00:00:27 Distance: (default is 120) Routing Protocol is "rip"//路由器上运行的路由协议是RIPOutgoing update filter list for all interfaces is not set//在出方向上没有设置过滤列表Incoming update filter list for all interfaces is not set//在入方向上没有设置过滤列表Sending updates every 30 seconds, next due in 24 seconds//更新周期是30 秒,距离下次更新还有24 秒//为了防止更新同步,RIP 会以15%的误差发送更新,即实际发送更新的周期的范围是25.5-30 秒。Invalid after 180 seconds, hold down 180, flushed after 240//invalid after:路由条目在180 秒没有收到更新,则被标记为无效//hold down:抑制计时器的时间为180 秒//flushed after:路由条目如果在240 秒还没有收到更新,则从路由表中删除此路由条目Redistributing: rip//只运行RIP 协议,没有其它的协议重分布进来Default version control: send version 2, receive version 2//默认发送版本2的路由更新,接收本版2 的路由更新Interface Send Recv Triggered RIP Key-chainSerial1/0 2 2Serial1/1 2 2Loopback0 2 2//以上三行显示了运行RIP 协议的接口,以及可以接收和发送的RIP 路由更新的版本RIPv2 【提示】 默认情况下只接收和发送版本2 的路由更新,可以通过命令“ip rip send version”和“ip rip receive version”来控制在路由器接口上接收和发送的版本,例如在s1/0 接口上接收版本1 和2 的路由更新,但是只发送版本2 的路由更新,配置如下:R1(config-if)#ip rip send version 2R1(config-if)#ip rip receive version 1 2Automatic network summarization is not in effect//RIP 路由协议关闭自动汇总功能Maximum path: 4//RIP 路由协议可以支持4 条等价路径,最大为6 条【提示】可以通过下面的命令来修改RIP 路由协议支持等价路径的条数:R1(config-router)#maximum-paths number-pathsRouting for Networks: 1.0.0.0 192.168.12.0 192.168.13.0//以上三行表明RIP 通告的网络Routing Information Sources: Gateway Distance Last Update 192.168.13.3 120 00:00:04 192.168.12.2 120 00:00:27//以上三行表明路由信息源,其中://gateway:学习路由信息的路由器的接口地址,也就是下一跳地址//distance:管理距离//last update:更新发生在多长时间以前Distance: (default is 120)//默认管理距离是120
实验7-3 : RIPV2 认证和触发更新
实验目的通过本实验可以掌握:(1)RIPv2 明文认证的配置和匹配原则(2)RIPv2 MD5 认证的配置和匹配原则(3)RIPv2 触发更新 实验拓扑
实验步骤
n 步骤1:配置路由器R2R2(config)#key chain test //配置钥匙链R2(config-keychain)#key 1 //配置KEY IDR2(config-keychain-key)#key-string cisco //配置KEY ID 的密匙R2(config)#interface s1/0R2(config-if)#ip rip authentication mode md5 //启用认证,认证模式为密文,默认认证模式是明文,所以也可以不用指定R2(config-if)#ip rip authentication key-chain test //在接口上调用钥匙链R2(config-if)#ip rip triggered //在接口上启用触发更新n 步骤2:配置路由器R1R1(config)#key chain testR1(config-keychain)#key 1R1(config-keychain-key)#key-string ciscoR1(config)#interface s1/0R1(config-if)#ip rip authentication mode md5R1(config-if)#ip rip authentication key-chain testR1(config-if)#ip rip triggeredR1(config-if)#interface s1/1R1(config-if)#ip rip authentication mode md5R1(config-if)#ip rip authentication key-chain testR1(config-if)#ip rip triggeredn 步骤3:配置路由器R3R3(config)#key chain testR3(config-keychain)#key 1R3(config-keychain-key)#key-string ciscoR3(config)#interface s1/1R3(config-if)#ip rip authentication mode md5R3(config-if)#ip rip authentication key-chain testR3(config-if)#ip rip triggered 实验调试(1)R1#show ip protocolRouting Protocol is "rip" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Sending updates every 30 seconds, next due in 23 seconds Invalid after 180 seconds, hold down 0, flushed after 240 // 由于触发更新,hold down 计时器自动为0 Redistributing: rip Default version control: send version 2, receive version 2 Interface Send Recv Triggered RIP Key-chain Serial1/0 2 2 Yes test Serial1/1 2 2 Yes test Loopback0 2 2 //以上两行表明s1/0 和s1/1 接口启用了认证和触发更新 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 1.0.0.0 192.168.12.0 192.168.13.0 Routing Information Sources: Gateway Distance Last Update 192.168.13.3 120 00:02:03 192.168.12.2 120 00:03:16 Distance: (default is 120) (2)R1#debug ip ripRIP protocol debugging is onR1#clear ip route **Mar 1 01:15:11.099: RIP: sending triggered request on Serial1/0 to 224.0.0.9*Mar 1 01:15:11.115: RIP: sending triggered request on Serial1/1 to 224.0.0.9*Mar 1 01:15:11.119: RIP: sending request on Loopback0 to 224.0.0.9*Mar 1 01:15:11.143: RIP: send v2 triggered flush update to 192.168.12.2 on Serial1/0 with no route*Mar 1 01:15:11.143: RIP: start retransmit timer of 192.168.12.2*Mar 1 01:15:11.143: RIP: send v2 triggered flush update to 192.168.13.3 on Serial1/1 with no route*Mar 1 01:15:11.143: RIP: start retransmit timer of 192.168.13.3*Mar 1 01:15:11.187: RIP: received packet with MD5 authentication*Mar 1 01:15:11.191: RIP: received v2 triggered update from 192.168.12.2 on Serial1/0*Mar 1 01:15:11.191: RIP: sending v2 ack to 192.168.12.2 via Serial1/0 (192.168.12.1), flush, seq# 5*Mar 1 01:15:11.199: 2.2.2.0/24 via 0.0.0.0 in 1 hops*Mar 1 01:15:11.207: RIP: received packet with MD5 authentication*Mar 1 01:15:11.211: RIP: received v2 triggered update from 192.168.12.2 on Serial1/0*Mar 1 01:15:11.211: RIP: sending v2 ack to 192.168.12.2 via Serial1/0 (192.168.12.1), flush, seq# 6*Mar 1 01:15:11.231: 2.2.2.0/24 via 0.0.0.0 in 1 hops*Mar 1 01:15:11.235: RIP: received packet with MD5 authentication*Mar 1 01:15:11.235: RIP: received v2 triggered ack from 192.168.12.2 on Serial1/0 flush seq# 4*Mar 1 01:15:11.239: RIP: send v2 triggered update to 192.168.12.2 on Serial1/0*Mar 1 01:15:11.243: RIP: build update entries*Mar 1 01:15:11.243: route 37: 1.1.1.0/24 metric 1, tag 0*Mar 1 01:15:11.247: route 39: 192.168.13.0/24 metric 1, tag 0*Mar 1 01:15:11.247: RIP: Update contains 2 routes, start 37, end 43*Mar 1 01:15:11.251: RIP: start retransmit timer of 192.168.12.2*Mar 1 01:15:11.279: RIP: received packet with MD5 authentication*Mar 1 01:15:11.283: RIP: received v2 triggered update from 192.168.13.3 on Serial1/1*Mar 1 01:15:11.287: RIP: sending v2 ack to 192.168.13.3 via Serial1/1 (192.168.13.1), flush, seq# 5*Mar 1 01:15:11.291: 3.3.3.0/24 via 0.0.0.0 in 1 hops*Mar 1 01:15:11.295: RIP: received packet with MD5 authentication*Mar 1 01:15:11.299: RIP: received v2 triggered update from 192.168.13.3 on Serial1/1*Mar 1 01:15:11.303: RIP: sending v2 ack to 192.168.13.3 via Serial1/1 (192.168.13.1), flush, seq# 6*Mar 1 01:15:11.307: 3.3.3.0/24 via 0.0.0.0 in 1 hops*Mar 1 01:15:11.311: RIP: received packet with MD5 authentication*Mar 1 01:15:11.311: RIP: received v2 triggered ack from 192.168.13.3 on Serial1/1 flush seq# 3【提示】 从上面的输出可以看出,在R1 上,虽然我们打开了debug ip rip,但是由于采用触发更新,所以并没有看到每30 秒更新一次的信息,而是清除了路由表这件事件触发了路由更新。而且所有的更新中都有“triggered”的字样,同时在接收的更新中带有“MD5 authentication”的字样,证明接口s1/0 和s1/1 启用了触发更新和密文认证(3) R1#show ip rip database1.0.0.0/8 auto-summary1.1.1.0/24 directly connected, Loopback02.0.0.0/8 auto-summary2.2.2.0/24 [1] via 192.168.12.2, 00:14:59 (permanent), Serial1/0 * Triggered Routes: - [1] via 192.168.12.2, Serial1/03.0.0.0/8 auto-summary3.3.3.0/24 [1] via 192.168.13.3, 00:14:59 (permanent), Serial1/1 * Triggered Routes: - [1] via 192.168.13.3, Serial1/1192.168.12.0/24 auto-summary192.168.12.0/24 directly connected, Serial1/0192.168.13.0/24 auto-summary192.168.13.0/24 directly connected, Serial1/1以上输出进一步说明了在s1/0 和s1/1 启用了触发更新。(4) R1#show run | begin router rip router rip version 2 timers basic 30 180 0 240//由于触发更新,在配置中自动加入上面一行,且hold down 计时器被设置为0 network 1.0.0.0 network 192.168.12.0 network 192.168.13.0 no auto-summary