RIPv2和RIPng都使用值1-16(表示跳數)的度量,最大跳數爲15,16表示不可達,在收到路由更新時路由器會遞增該度量值,但RIPng和RIPv2的處理方法有重大區別,下面經過實驗進行分析;
網絡
R一、R二、R3之間運行RIPng,路由配置以下,其它配置略;ide
R1的路由配置:spa
R1(config)#int loo 0orm
R1(config-if)#ipv6 ripMao enable //RIPng進程Mao只起本地意義,與OSPF的進程號功能相同;接口下配置該命令後,會在全局下生成ipv6 router rip Maorouter
R1(config-if)#int s1/0 blog
R1(config-if)#ipv6 rip Mao enable接口
R1(config-if)#int fa0/0進程
R1(config-if)#ipv6 rip Mao enableip
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的最大不一樣之處。