RIPv2和RIPng都使用值1-16(表示跳数)的度量,最大跳数为15,16表示不可达,在收到路由更新时路由器会递增该度量值,但RIPng和RIPv2的处理方法有重大区别,下面通过实验进行分析;
R1、R2、R3之间运行RIPng,路由配置如下,其它配置略;
R1的路由配置:
R1(config)#int loo 0
R1(config-if)#ipv6 ripMao enable //RIPng进程Mao只起本地意义,与OSPF的进程号功能相同;接口下配置该命令后,会在全局下生成ipv6 router rip Mao
R1(config-if)#int s1/0
R1(config-if)#ipv6 rip Mao enable
R1(config-if)#int fa0/0
R1(config-if)#ipv6 rip Mao enable
R2的路由配置:
R2(config)#int loo 0
R2(config-if)#ipv6 rip Ting en
R2(config-if)#int s1/0
R2(config-if)#ipv6 rip Ting enable
R2(config-if)#int fa0/0
R2(config-if)#ipv6 rip Ting enable
R3的路由配置:
R3(config-if)#int fa1/0
R3(config-if)#ipv6 rip
R3(config-if)#ipv6 rip Hai en
R3(config-if)#int fa0/0
R3(config-if)#ipv6 rip Hai en
R3(config-if)#int loo 0
R3(config-if)#ipv6 rip Hai en
在R1与R3之间抓包分析;
抓包可知,R1在通告路由时,将2011::1/128(R1的环回接口ipv6地址)的跳数设置为1,现在R3上查看该路由的情况
R3#show ipv6 route rip
IPv6 Routing Table -default - 11 entries
Codes: C - Connected, L- Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - MobileRouter, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA- ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRPexternal, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE -Destination, NDr - Redirect
O - OSPF Intra, OI - OSPF Inter, OE1 -OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSAext 2, l - LISP
R 2001:A:A:12::/64 [120/2]
via FE80::C802:22FF:FEF8:8,FastEthernet1/0
via FE80::C801:39FF:FE8C:8,FastEthernet0/0
R 2011::1/128 [120/2]//其跳数置为2,增加了1;
viaFE80::C801:39FF:FE8C:8, FastEthernet0/0
R 2022::2/128 [120/2]
via FE80::C802:22FF:FEF8:8,FastEthernet1/0
现将R1和R2、R3同时配置RIP协议,配置略,看看路由器R3上的路由的度量值情况与RIPng有什么不同,在R1和R3之间进行抓包如下:
在R1和R3之间抓包可知,R1通告给R3的1.1.1.1/32路由的跳数值为1,现在R3上查看路由表情况
R3#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
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
R 1.1.1.1[120/1] via 13.1.1.1, 00:00:17, FastEthernet0/0 //其跳数值还是为1,R3并没有将其跳数值递增1;
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/1] via 23.1.1.1, 00:00:01, FastEthernet1/0
12.0.0.0/30 is subnetted, 1 subnets
R 12.1.1.0 [120/1] via 23.1.1.1, 00:00:01, FastEthernet1/0
[120/1] via 13.1.1.1,00:00:17, FastEthernet0/0
在R2上查看路由1.1.1.1/32的路由情况
R2#showip route rip //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
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
R 1.1.1.1[120/2] via 23.1.1.2, 00:00:28, FastEthernet0/0
//其跳数为2
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/1] via 23.1.1.2, 00:00:28, FastEthernet0/0
13.0.0.0/30 is subnetted, 1 subnets
R 13.1.1.0 [120/1] via 23.1.1.2, 00:00:28, FastEthernet0/0
在R2和R3之间的接口抓包可知,R3将1.1.1.1/32通告给R2时,其将其度量值(跳数)加1之后,再传递给R2;
R2#show ipv6 route rip //IPv6 RIP路由表
IPv6 Routing Table - default - 7 entries
Codes: C - Connected, L - Local, S - Static,U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2, l - LISP
R 2001:A:A:13::/64 [120/2]
via FE80::C803:35FF:FE30:1C, FastEthernet0/0
R 2011::1/128 [120/3]//R1的环回接口路由跳数为3
via FE80::C803:35FF:FE30:1C, FastEthernet0/0
R 2033::3/128 [120/2]
via FE80::C803:35FF:FE30:1C, FastEthernet0/0
从抓包结果可以看出来,R3将2011::1/128路由通告给路由器R2时,其度量值为2,而在R2的路由表中查看为其度量值为3,证明路由器R2将其度量值(跳数)递增1;
总结:RIPng在传递一条起源路由(本路由器产生的)至邻居路由器时,其度量值为1,邻居路由器会将路由的度量值递增1,其实起源路由器将自已纳入到目的网络的跳数之内。而RIP是在路由起源的下一跳邻居路由器传递给他的邻居路由器时,才会将该路由的度量值递增1,而不把路由起源的路由器算在达到目的网络的跳数之内。这也是RIPng与RIP的最大不同之处。