第5章
从本章开始,我们将进入到正式的路由协议,在TCP/IP协议栈中,最重要和应用最广泛的几个路由协议有:RIP协议、EIGRP协议(思科私有)、OSPF协议和BGP协议,我们将在今后几部分中一一为大家讲解。当然这些都是CCIE认证考试的重要组成部分,而且路由是一切应用的基础

乾颐堂安德
RIP协议

本章要点
 RIP理论基础和场景需求
 实验拓扑和需求描述
 RIP实验步骤

5.1 RIP理论基础和场景需求

RIP即路由信息协议,是最早的用于生产环境的TCP/IP协议栈的动态路由协议。相对静态来讲,动态路由更加灵活,但是相对的要维护动态路由协议的多种报文
RIP协议的处理是通过UDP520的端口来操作的。当然RIP的最终极目的还是更新路由,使得路由器的控制层面得以构建
RIP定义了两种信息类型:请求信息和响应信息。作为参考,我们给出一个RIPv2的典型报文,可以清晰的看到其工作在UDP层面,这是一个response报文(RIP另外一个报文是request,用于请求路由表)
思科企业基础架构CCIE全系实验:RIP协议_第1张图片

图5-1 Wireshark抓取的RIPv2的Response报文
RIP使用一个单一的路由度量(跳数)测量到达目的网络的距离,最大度量为15跳,如果一条路由的条数为16跳则不可达
RIP有一系列的计时器协同工作:
更新计时器update timer(30秒)
无效计时器invalid timer(180秒)
flush冲刷计时器(无效计时器长60秒,RFC1058规定为120S)
抑制计时器(180秒,思科私有参数)
如果路由更新通告的跳数大于路由表已记录的跳数,并且更新来自于已记录条目的下一跳路由器,那么该路由将在一个指定的抑制时间段内被标记为不可到达。如果在抑制时间超时后,同一台邻居路由器仍然通告这个有较大跳数的路由,路由器则接受该路由新的度量值
RIP还有一系列的防环机制:
① 水平分割-把信息从收到它的方向发回去没有任何意义。
② 毒性逆转-从一个接口接收到的路由,从同一个接口update出去的时候,metric值设为最大,16跳。
③ 路由毒化-路由器向外宣告无效路由时,将其跳数置为最大值。
④ 触发更新。
RIP的分类:RIP分为V1和V2.其中RIPv1为有类路由(它在更新路由信息时不携带子网掩码)
RIP作为TCP/IP协议栈的第一代动态路由协议已经很少使用,但是仍然是CCIE认证中不可或缺的部分,虽然分值仅仅在2分左右(同时不会涉及RIPv1)。因为它确实还可以用于性能不太理想的中小型分制企业的路由器,同时它还是一个公有标准的路由协议

5.2 实验拓扑和需求描述

思科企业基础架构CCIE全系实验:RIP协议_第2张图片

图5-2 在Branch和HQ完成RIP协议
本实验中仅仅用到Branch和HQ设备,不用关心SW1和SW2。通过配置Branch和HQ设备完成对RIP的理解。如图5-2为本实验的拓扑图。

5.3 RIP实验步骤

5.3.1 配置RIPv1,并观察有类路由

RIP分为v1和v2,RIPv1有很多弱点,比如它是一个有类路由,更新路由时仅仅有前缀,而没有掩码,不携带下一跳,不支持认证等特点。我们在此依旧使用和配置RIPv1的目的是为了理解动态路由协议,同时是为了保持知识的完整性和流畅性
Branch的IP地址验证:
Branch#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 unassigned YES NVRAM up up
Ethernet0/0.10 10.1.10.254 YES manual up up
Ethernet0/0.20 10.1.20.254 YES manual up up
Ethernet0/1 192.168.1.1 YES manual up up
说明:e0/0的两个子接口为下联PC的网关,相关配置如下:
interface Ethernet0/0.10
encapsulation dot1Q 10
ip address 10.1.10.254 255.255.255.0
interface Ethernet0/0.20
encapsulation dot1Q 20
ip address 10.1.20.254 255.255.255.0
HQ设备地址配置:
HQ#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 172.16.1.254 YES manual up up
Ethernet0/1 192.168.1.2 YES manual up up
Ethernet0/2 unassigned YES NVRAM up up
Ethernet0/3 unassigned YES NVRAM up up
Branch和HQ配置RIPv1
Branch:
router rip
network 10.0.0.0—RIP仅仅可以通告主类路由,不带任何掩码
network 192.168.1.0—通告和HQ的直连网段,用于同步RIP的数据库
no auto-summary---需要说明的是,RIPv1为有类路由,是否关掉自动汇总没有任何意义,因为它在
更新时不携带任何掩码信息,都为主类的路由,我们将在后边专门讨论RIP的
自动汇总(事实上,任何一种距离适量协议我们都做讨论)
HQ:
router rip
network 172.16.0.0
network 192.168.1.0—通告和Branch的直连网段,用于同步RIP的数据库。注意HQ没有关掉自动汇总
验证:
Branch#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set
R 172.16.0.0/16 [120/1] via 192.168.1.2, 00:00:22, Ethernet0/1—虽然HQ的接口为24位掩码,但
是由于RIPv1是有类的,则总是
传递不带子网的路由
HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:05, Ethernet0/1
下图5-3为RIPv1的报文仅供参考,其中可以看到RIPv1的request报文目标地址为广播地址255.255.255.255
思科企业基础架构CCIE全系实验:RIP协议_第3张图片

图5-3 RIPv1的报文

5.3.2 认识和配置RIPv2

RIPv2协议不是一个新的协议,它只是在RIPv1协议的基础上增加了一些扩展特性:
每个路由条目都携带自己的子网掩码,支持VLSM、支持无类路由CIDR查找
路由选择更新具有认证功能
每个路由条目都携带下一跳地址
通过组播路由更新(224.0.0.9)
默认情况下路由在跨越主类网络边界时,会自动汇总,但是也可以关闭自动汇总,进行手动汇总
特别需要说明的是,有无数的学员会在实施RIP时,在某一端忘记配置”version 2“命令,这将引起巨大的麻烦
Branch:
router rip
version 2—配置为RIPv2,注意两端都需要配置RIPv2,否则会出现路由缺失的问题
network 10.0.0.0
network 192.168.1.0
no auto-summary—关闭自动汇总,然后观察路由,注意,RIPv2为无类路由,即路由更新携带掩码
信息,我们会看到子网。注意关掉自动汇总才是我们常用的策略
HQ:
router rip
version 2
network 172.16.0.0
network 192.168.1.0
no auto-summary
验证:
如果我们没有通过clear ip route 的命令来清除路由的话,我们可能会看到下面的情况:
Branch#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
R 172.16.0.0/16 is possibly down,
routing via 192.168.1.2, Ethe---该路由可能已经不可达。这是因为该路由已经无效,但是
还没被冲刷掉,所以RIP并不是一个收敛速度很快的协议
R 172.16.1.0/24 [120/1] via 192.168.1.2, 00:00:24, Ethernet0/1
HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/24 is subnetted, 2 subnets

R 10.1.10.0 [120/1] via 192.168.1.1, 00:00:24, Ethernet0/1
R 10.1.20.0 [120/1] via 192.168.1.1, 00:00:24, Ethernet0/1
此时我们得到的路由才是一个正确的非常具体的明细路由,这是也最通常的情况

5.3.3 观察RIP的自动汇总

再次重申,关掉自动汇总才是我们最常用的手段,一定意义上自动汇总(目的是减少路由表)会造成某些拓扑中的路由器不知道如何路由数据包
① RIP会把本身产生的路由(通告)、重分布的路由汇总到主类的边界,比如10.1.1.0/24的路由会自动汇总到10.0.0.0/8。
Branch(config)#router rip
Branch(config-router)#auto-summary---该命令是默认的,在之前我们关掉,此时再次配置
!
HQ(config)#router rip
HQ(config-router)#auto-summary
此时,没有刷新路由表时的情况:
HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks

R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:16, Ethernet0/1—自动汇总得到的路由
R 10.1.10.0/24 [120/1] via 192.168.1.1, 00:00:44, Ethernet0/1---之前关闭自动汇总得到的路由
R 10.1.20.0/24 [120/1] via 192.168.1.1, 00:00:44, Ethernet0/1
如果你有足够的耐心,你可以看到下面的情况:
Branch#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

R 172.16.0.0/16 [120/1] via 192.168.1.2, 00:00:21, Ethernet0/1---从对端更新得到的汇总到主
类的路由(B类默认的16位
的掩码)
R 172.16.1.0/24 [120/1] via 192.168.1.2, 00:03:03, Ethernet0/1---请读者注意一下次此处的时间,3分03秒即180秒(会多出一点点)该路由还出于老化计时器的时间之内
Branch#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

R 172.16.0.0/16 [120/1] via 192.168.1.2, 00:00:25, Ethernet0/1
R 172.16.1.0/24 is possibly down,
routing via 192.168.1.2, Ethe---此时在冲刷计时器的时间内
为了更好的观察RIPv2,HQ观察debug ip rip得到的报文
Oct 20 06:18:07.594: RIP: sending v2 update to 224.0.0.9 via Ethernet0/1 (192.168.1.2)---从该接口发送
组播更新
Oct 20 06:18:07.594: RIP: build update entries
Oct 20 06:18:07.594: 172.16.0.0/16 via 0.0.0.0, metric 1, tag 0---更新汇总之后的16的路由,注意
此处的0.0.0.0是固定的,tag为0
(外部路由可以设置该值)
HQ#
Oct 20 06:18:09.113: RIP: received v2 update from 192.168.1.1 on Ethernet0/1
Oct 20 06:18:09.113: 10.0.0.0/8 via 0.0.0.0 in 1 hops---一个汇总到主类边界的路由
HQ#
Oct 20 06:18:19.163: RIP: sending v2 update to 224.0.0.9 via Ethernet0/0 (172.16.1.254)
Oct 20 06:18:19.164: RIP: build update entries
Oct 20 06:18:19.165: 10.0.0.0/8 via 0.0.0.0, metric 2, tag 0
Oct 20 06:18:19.165: 192.168.1.0/24 via 0.0.0.0, metric 1, tag 0
② 接下来HQ关掉自动汇总,Branch保持自动汇总。
HQ(config-router)#no auto-summary
两台设备clear ip route

HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:20, Ethernet0/1---Branch保持了自动汇总,那么该设
备更新报文时就已经进行过汇总,
所以得到了/8的路由
Branch#sh ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  172.16.0.0/24 is subnetted, 1 subnets

R 172.16.1.0 [120/1] via 192.168.1.2, 00:00:12, Ethernet0/1---HQ关掉了自动汇总,那么HQ
更新报文时就是/24的路由,所
以该设备得到了明细路由
③ 不自动汇总的情况。
对于连续子网的环境,在通告路由给邻居的时候,会带上子网掩码,通告明细路由
为了观察该现象,我们需要改造一下拓扑,把Branch和HQ的直连改为/30的子网,把HQ的e0/0地址改为192.168.1.5/30.同时两台设备都开启自动汇总
Branch:
interface Ethernet0/1
ip address 192.168.1.1 255.255.255.252
router rip
version 2
network 10.0.0.0
network 192.168.1.0
HQ:
interface Ethernet0/0
ip address 192.168.1.5 255.255.255.252
interface Ethernet0/1
ip address 192.168.1.2 255.255.255.252
router rip
version 2
network 172.16.0.0
network 192.168.1.0
验证:
Branch#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  192.168.1.0/24 is variably subnetted, 3 subnets, 2 masks

R 192.168.1.4/30 [120/1] via 192.168.1.2, 00:00:15, Ethernet0/1
我们发现此时Branch得到的路由是一个没有汇总的路由,因为此时HQ的192.168.1.0/30和192.168.1.4/30是连续的子网(在同一个主类网络前缀)

5.3.4 RIP的单播更新和PASSIVE

passive-interface是指RIP不发组播更新,可以接收更新,此时可以用neighbor命令指定邻居可以单播更新。总体上而言这是一种节省路由器资源的技术,因为需要把连接主机的接口所在网络更新给对端,而同时该接口是不需要对主机发送路由更新的。
如果没有passive-interface,而用neighbor命令指定邻居,那么RIP进程单播、组播更新一起发送。
在配置下面步骤之前请自行关掉两个设备的自动汇总(省略)
Branch:
router rip
version 2
passive-interface default—passive掉所有运行RIP的接口,当然此时也可以单独passive掉e0/1接口
network 10.0.0.0
network 192.168.1.0
no auto-summary
HQ:
router rip
version 2
passive-interface default
network 172.16.0.0
network 192.168.1.0
no auto-summary
清除完毕路由之后会发现没有任何路由,因为本身这就是一种抑制路由更新的技术
下面配置单播更新路由
Branch(config-router)#neighbor 192.168.1.2

HQ(config-router)#neighbor 192.168.1.1
如果开启debug ip rip 的话会看到如下信息:
Oct 20 07:55:44.668: RIP: sending v2 update to 192.168.1.2 via Ethernet0/1 (192.168.1.1)—单播更新
Oct 20 07:55:44.668: RIP: build update entries
Oct 20 07:55:44.668: 10.1.10.0/24 via 0.0.0.0, metric 1, tag 0
Oct 20 07:55:44.668: 10.1.20.0/24 via 0.0.0.0, metric 1, tag 0

5.3.5 RIPv2的认证

RIPv1不支持认证
RIPv2支持明文和MD5认证,如果认证不通过,则不会收到来自邻居的路由信息。需要说明的是路由协议的认证并不像ppp一样是认证链路的
配置MD5认证:
Branch:
key chain QYT---“钥匙链”名为QYT,具有本地意义,即两端可以不同
key 1---任何的MD5的key ID必须要相同
key-string cisco---key的密码两端要相同
interface Ethernet0/1
ip address 192.168.1.1 255.255.255.252
ip rip authentication mode md5---开启RIP的认证模式为MD5
ip rip authentication key-chain QYT---调用key chain

HQ:
key chain QYT
key 1
key-string cisco
interface Ethernet0/1
ip address 192.168.1.2 255.255.255.252
ip rip authentication mode md5
ip rip authentication key-chain QYT
验证:
HQ#show key chain
Key-chain QYT:
key 1 -- text "cisco"
accept lifetime (always valid) - (always valid) [valid now]
send lifetime (always valid) - (always valid) [valid now]
验证路由情况
HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  10.0.0.0/24 is subnetted, 2 subnets

R 10.1.10.0 [120/1] via 192.168.1.1, 00:00:20, Ethernet0/1
R 10.1.20.0 [120/1] via 192.168.1.1, 00:00:20, Ethernet0/1
配置明文认证更加简单,默认情况下RIPv2就是明文认证,只要不开启MD5认证即为明文认证
Branch(config)#interface e0/1
Branch(config-if)#no ip rip authentication mode md5
此时就开启了text认证,如果另外一端不去掉则无法同步路由信息

5.3.6 RIPv1和RIPv2的兼容性问题

该问题存在于一端运行RIPv1,另外一端运行RIPv2的场景。我们用如下实验验证兼容性以及解决方案
我们恢复配置如下:
Branch:
router rip
network 10.0.0.0
network 192.168.1.0
no auto-summary---注意,此时默认运行了RIPv1,关闭自动汇总其实是无效的
HQ:
router rip
version 2
network 192.168.1.0
no auto-summary
验证路由情况:
Branch#show ip route rip ---Branch收到了HQ的路由
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

  192.168.1.0/24 is variably subnetted, 3 subnets, 3 masks

R 192.168.1.4/30 [120/1] via 192.168.1.2, 00:00:17, Ethernet0/1
Branch#show ip protocols
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 14 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered RIP Key-chain
Ethernet0/0.10 1 1 2
Ethernet0/0.20 1 1 2
Ethernet0/1 1 1 2 ---默认情况下RIPv1一侧发送V1的报文,接收V1和V2
的报文,所有Branch接收了HQ的RIPv2报文,生成了
路由表
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
10.0.0.0
192.168.1.0
Routing Information Sources:
Gateway Distance Last Update
192.168.1.2 120 00:00:20
Distance: (default is 120)
此时HQ就没有那么幸运,它不会收到路由:
HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set
通过如下命令验证RIP的信息
HQ#show ip protocols
IP Routing is NSF aware

Routing Protocol is "application"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 32
Routing for Networks:
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 4)

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 9 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
Ethernet0/0 2 2
Ethernet0/1 2 2 ---HQ因为运行了RIPv2,默认情况下发送并接收的报文
仅仅是RIPv2,所以不能收取RIPv1的报文,RIP的数据
库都不会显示
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
192.168.1.0
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 120)
HQ#show ip rip database ---数据库没有对端的路由表项
192.168.1.0/24 auto-summary
192.168.1.0/30 directly connected, Ethernet0/1
192.168.1.4/30 directly connected, Ethernet0/0
我们可以使用接口下的兼容命令完成解决方案:
HQ:
interface Ethernet0/1
ip address 192.168.1.2 255.255.255.252
ip rip receive version 1 2---HQ接口下可以接收两个版本的RIP消息(当然也可以设置发送的报文类型)
验证:
HQ#show ip route rip
Codes: L - local, 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, H - NHRP, l - LISP
a - application route

    • replicated route, % - next hop override

Gateway of last resort is not set

R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:25, Ethernet0/1
HQ收到了对端的路由。当然最好的方案是两侧都配置RIPv2