IPv6-5-RIPng
一、理论支持和实验目的
支持IPv6的RIPng
虽然是基于RIPv2协议的,但它并不是RrPv2的简单扩展,它实际上是一个完全独立的协议。RIPng协议不支持IPv4,因此读者如果同时在IPv4和IPv6环境里使用RIP作为路由选择协议,就必须运行支持IPv4的RIPvl或RIPv2,以及支持IPv6的RIPng。
RIPng使用与RlPv2相同的计时器、过程处理和消息类型。例如,RIPng像RIPv2—样,使用30s的更新计时器抖动来避免消息同步,还有180的超时周期、120s的垃圾收集计时器和180s的抑制计时器(默认显示0)。它也使用相同的跳数度量,16跳
示不可到达。RIPng也用与RIPv2相同的方式使用请求和响应消息(command1和command2)。另外,除了类似于RIPvl和RIPv2一样用到少数单播方式外,像RIPv2一样,RIPng大多是以多播方式收发请求和响应消息。RIPng使用的IPv6多播地址是FF02::9。除了上述这些类似的功能外,一个例外之处是认证功能。RIPng本身并没有认证机制,但是承担认证功能的特性已经集成到IPv6中了。
当然,Rpng也不需要像RIPv2那样要求具有对R1Pvl的兼容性开关,因为它本来就不向后支持IPv4协议
RIPng采用UDP521端口(但是可修改),不再支持自动汇总,因为IPv6已经没有了A、B、C的主类分类,支持接口下的手工汇总
二、拓扑描述
如图所示,每个设备上的地址
为20xy::x/64如图R3连接R4的接口地址为2034::3/64,每个设备的环回口为20XX::X/128,比如R1的环回口为2011::1/128
三、实验步骤
1、建立基本的RIPng(可以没有全局单播地址)
IPv6地址已经配置完毕
R2(config)#ipv6 unicast-routing
R2(config)#interface loopback 0
R2(config-if)#ipv6 rip Ender enable---在接口下使能RIPng,其中Ender是一个标识,RIPng的配置直接在接口下完成
R2(config)#int e0/0
R2(config-if)#ipv6 rip Ender enable
同时请在R3和R4上完成相应配置
RIPng和eigrp g for IPv6以及OSPFv3同,以link-local地址作为数据包的源,所以每个接口可以拥有多个IPv6全局单播地址或者不拥有IPv6全局单播地址(但是一定要有link-local地址)
我们以R3和R4为例验证上面理论
R4(config)#interface Ethernet0/1
R4(config-if)#ipv6 enable---该接口没有全局单播地址,但是使能了IPv6,会拥有link-local地址,同时使能了RIPng
R4(config-if)# ipv6 rip Ender enable
!
R3(config)#interface Ethernet0/1
R3(config-if)# ipv6 address 2034::3/64
R3(config-if)# ipv6 rip Ender enable
我们在R4上查看RIPng的数据库
R4#sh ipv6 rip database
RIP process "Ender", local RIB
2022::2/128, metric 3, installed
Ethernet0/1/FE80::CE03:2CFF:FE80:1, expires in 175 secs
2033::3/128, metric 2, installed
Ethernet0/1/FE80::CE03:2CFF:FE80:1, expires in 175 secs
2034::/64, metric 2, installed
Ethernet0/1/FE80::CE03:2CFF:FE80:1, expires in 175 secs
2123::/64, metric 2, installed
Ethernet0/1/FE80::CE03:2CFF:FE80:1, expires in 175 secs
数据库中已经存在了相应的数据,这意味着RIP在正常运行。同时由于R4上并没有路由2034::/64(R1拥有的前缀),所以R4将学习到R3的该前缀。还有一点需要注意,在RIPng中(或者说在所有的IPv6路由协议中),下一跳都为link-local地址,而非全局单播地址
R4#sh ipv6 route rip
IPv6 Routing Table - 7 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R 2022::2/128 [120/3]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2033::3/128 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2034::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2123::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
2、验证同一设备多进程以及毒性反转和一些调整
A、进程在每台设备上是本地有效的,这意味着两端的设备的进程可以不一致,但依旧能同步数据库
R3(config-if)#no ipv6 rip Ender enable
R3(config-if)#ipv6 rip CCIE enable---需要注意的是R3和R4的进程名并不一致,R4上没有任何变化
R4#sh ipv6 rip database ---R4已经和R3进行了同步,但是我们发现数据库条目并不完整,原因在于R3上有两个进程
RIP process "Ender", local RIB
2034::/64, metric 2, installed
Ethernet0/1/FE80::CE03:2CFF:FE80:1, expires in 165 secs
查看R3的情况:
R3#sh ipv6 rip
RIP process "Ender", port 521, multicast-group FF02::9, pid 184
Administrative distance is 120. Maximum paths is 16
Updates every 30 seconds, expire after 180
Holddown lasts 0 seconds, garbage collect after 120
Split horizon is on; poison reverse is off
Default routes are not generated
Periodic updates 52, trigger updates 3
Interfaces:
Loopback0
Ethernet0/0
Redistribution:
None
RIP process "CCIE", port 521, multicast-group FF02::9, pid 186
Administrative distance is 120. Maximum paths is 16
Updates every 30 seconds, expire after 180
Holddown lasts 0 seconds, garbage collect after 120
Split horizon is on; poison reverse is off
Default routes are not generated
Periodic updates 7, trigger updates 0
Interfaces:
Ethernet0/1
Redistribution:
解决
:可以在R3上做两个进程的双向重分步
R3(config)#ipv6 router rip Ender
R3(config-rtr)# redistribute rip CCIE metric 2 include-connected---重分步时需要注意“包含直连”的参数,否则直连不会被重分步进去
R3(config-rtr)#ipv6 router rip CCIE
R3(config-rtr)# redistribute rip Ender include-connected
R4#sh ipv6 route rip---双向重分步之后路由已经完整
IPv6 Routing Table - 7 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R 2022::2/128 [120/3]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2033::3/128 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2034::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2123::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
B、毒性反转--从某个接口收到的路由如果从该接口更新出去时,把metric置为16才更新,毒性反转默认是关闭的:
R4#sh ipv6 rip
RIP process "Ender", port 521, multicast-group FF02::9, pid 184
Administrative distance is 120. Maximum paths is 16
Updates every 30 seconds, expire after 180
Holddown lasts 0 seconds, garbage collect after 120
Split horizon is on; poison reverse is off
Default routes are not generated
Periodic updates 112, trigger updates 18
Interfaces:
Loopback0
Ethernet0/1
Redistribution:
None
我们来开启毒性反转:
R4(config)#ipv6 router rip Ender
R4(config-rtr)#poison-reverse
R4#sh ipv6 rip
RIP process "Ender", port 521, multicast-group FF02::9, pid 184
Administrative distance is 120. Maximum paths is 16
Updates every 30 seconds, expire after 180
Holddown lasts 0 seconds, garbage collect after 120
Split horizon is on; poison reverse is on
Default routes are not generated
Periodic updates 113, trigger updates 18
Interfaces:
Loopback0
Ethernet0/1
Redistribution:
None
R4#debug ipv6 rip
*Mar 1 02:35:07.211: tag=0, metric=16, prefix=2033::3/128
*Mar 1 02:35:07.215: tag=0, metric=16, prefix=2034::/64
*Mar 1 02:35:07.215: tag=0, metric=16, prefix=2123::/64---这些路由从入接口更新出去时metric置为16跳
*Mar 1 02:35:07.219: tag=0, metric=16, prefix=2022::2/128
C、调整RIPng的几个时间值
R4(config)#ipv6 router rip Ender
R4(config-rtr)#timers 31 181 1 121
RIPng保留了RIPv2的几个时间值,周期更新时间默认30秒,超时时间180秒,holddown时间默认为0,garbage时间为120秒。上述命令修改了默认值
R4#sh ipv6 rip
RIP process "Ender", port 521, multicast-group FF02::9, pid 184
Administrative distance is 120. Maximum paths is 16
Updates every 31 seconds, expire after 181
Holddown lasts 1 seconds, garbage collect after 121
Split horizon is on; poison reverse is on
Default routes are not generated
Periodic updates 131, trigger updates 20
Interfaces:
Loopback0
Ethernet0/1
Redistribution:
None
D、修改默认的端口号或者组播组
RIPng默认采用UDP521,但是可以修改,需要注意的是两个更新数据库的设备端口号必须一致,组播组可以修改(但是不建议修改)
R4(config)#ipv6 router rip Ender
R4(config-rtr)#port 522 multicast-group ff02::9---端口号现在采用522,组播更新组没有修改
R4#debug ipv6 rip
R4#
*Mar 1 02:46:58.035: RIPng: Sending multicast update on Loopback0 for Ender
*Mar 1 02:46:58.039: src=FE80::CE00:2CFF:FE80:0---link-local地址
*Mar 1 02:46:58.039: dst=FF02::9 (Loopback0)
*Mar 1 02:46:58.043: sport=522, dport=522, length=112
请自行在R3上做相同的配置
我们来做数据包的验证,现在R4的直连接口并没有全局单播地址,只有link-local地址,那么此时数据包发出去时会找到一个全局可路由的全局单播地址作为源,那么此时就是R4的loopback口,一旦该接口down,就没有源
R4(config)#int lo0
R4(config-if)#shutdown
R4#ping 2022::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2022::2, timeout is 2 seconds:
*Mar 1 02:49:18.471: ICMPv6: Sending echo request to 2022::2.
*Mar 1 02:49:20.475: ICMPv6: Sending echo request to 2022::2.
*Mar 1 02:49:22.479: ICMPv6: Sending echo request to 2022::2.
*Mar 1 02:49:24.483: ICMPv6: Sending echo request to 2022::2.
*Mar 1 02:49:26.487: ICMPv6: Sending echo request to 2022::2.
Success rate is 0 percent (0/5)
!
R4(config)#int lo0
R4(config-if)#no sh
R4#ping 2022::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2022::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/32/52 ms
R4#
*Mar 1 02:50:22.555: ICMPv6: Sending echo request to 2022::2
*Mar 1 02:50:22.607: ICMPv6: Received ICMPv6 packet from 2022::2, type 129
R2上回包的情况
R2#debug ipv6 icmp
ICMP packet debugging is on
*Mar 1 02:50:23.435: ICMPv6: Received ICMPv6 packet from 2044::4, type 128
*Mar 1 02:50:23.439: ICMPv6: Received echo request from 2044::4
3、RIPng的默认路由、offset以及路由汇总
实现以上三个功能的命令在接口下操作
R3(config)#int e0/1
R3(config-if)#ipv6 rip CCIE default-information originate---产生默认路由
验证R4的默认路由:
R4#sh ipv6 route rip
IPv6 Routing Table - 8 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R ::/0 [120/2]---已经产生了默认路由
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2022::2/128 [120/3]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2033::3/128 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2034::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2123::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
!
R3(config-if)#ipv6 rip CCIE metric-offset 10---从e0/1接口更新的路由的跳数增加10
R3#sh ipv6 route rip
IPv6 Routing Table - 9 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R 2022::2/128 [120/2]
via FE80::CE02:2CFF:FE80:0, Ethernet0/0
R 2044::4/128 [120/11]---该路由的metric已经从10 增加到11
via FE80::CE00:2CFF:FE80:1, Ethernet0/1
!
R3(config-if)#int e0/0
R3(config-if)# ipv6 rip CCIE summary-address 2044::/48---汇总2044的路由到48位,然后更新出去
R2#sh ipv6 route rip
IPv6 Routing Table - 8 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R 2033::3/128 [120/2]
via FE80::CE03:2CFF:FE80:0, Ethernet0/0
R 2034::/64 [120/3]
via FE80::CE03:2CFF:FE80:0, Ethernet0/0
R 2044::4/128 [120/3]---汇总完毕
via FE80::CE03:2CFF:FE80:0, Ethernet0/0
4、探讨RIPng的RTE(尤其是下一跳RTE)
在RIPng里有两类RTE(RFC规定):
下一跳RTE:在一个广播网络中用于路由优化的手段,“下一跳不变理论”
IPv6前缀RTE:位于某个“下一跳RTE”的后面,同一个“下一跳RTE”的后面可以有多个不同的“IPv6前缀RTE”。它描述了RIPng路由表中的目的IPv6地址及开销。
Draft-ietf-rip-ripng-03.txt G. Malkin/Xylogics
R. Minnear/Ipsilon Networks
June 1996
原文:
2.1.1 Next Hop
RIPng provides the ability to specify the immediate next hop IPv6
address to which packets to a destination specified by a route table
entry (RTE) should be forwarded in much the same way as RIP-2 [2].
In RIP-2, each route table entry has a next hop field. Including a
next hop field for each RTE in RIPng would nearly double the size of
the RTE. Therefore, in RIPng, the next hop is specified by a special
RTE and applies to all of the address RTEs following the next hop RTE
until the end of the message or until another next hop RTE is encoun-
tered.
在本拓扑中,我们把R1的接口和R2的接口运行OSPFv3,然后在R2上做双向重分步
R1(config)#ipv6 unicast-routing
R1(config)#int loopback 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#ipv6 address 2011::1/128
R1(config-if)#ipv6 ospf 110 area 0
R1(config-if)#no shutdown
R1(config-if)#ipv6 address 2123::1/64
R1(config-if)#ipv6 ospf 110 area 0
!
R2(config)#ipv6 router ospf 110
R2(config-rtr)#router-id 2.2.2.2
R2(config)#interface e0/0
R2(config-if)#ipv6 ospf 110 area 0
!
R2(config)#ipv6 router ospf 110
R2(config-rtr)#redistribute rip Ender include-connected---做双向重分步
R2(config-rtr)#exit
R2(config)#ipv6 router rip Ender
R2(config-rtr)#redistribute ospf 110 metric 2
查看路由的情况:
R4#sh ipv6 route rip
IPv6 Routing Table - 9 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R ::/0 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2011::1/128 [120/4]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2022::2/128 [120/3]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2033::3/128 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2034::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
R 2123::/64 [120/2]
via FE80::CE03:2CFF:FE80:1, Ethernet0/1
!
R1#sh ipv6 route ospf
IPv6 Routing Table - 9 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OE2 2022::2/128 [110/20]
via FE80::CE02:2CFF:FE80:0, Ethernet0/0
OE2 2033::3/128 [110/20]
via FE80::CE02:2CFF:FE80:0, Ethernet0/0
OE2 2034::/64 [110/20]
via FE80::CE02:2CFF:FE80:0, Ethernet0/0
OE2 2044::4/128 [110/20]
via FE80::CE02:2CFF:FE80:0, Ethernet0/0
路由完整,让我们来tracert一下
R4#traceroute 2011::1
Type escape sequence to abort.
Tracing the route to 2011::1
1 2034::3 36 msec 36 msec 8 msec
2 2123::2 8 msec 48 msec 12 msec
3 2011::1 8 msec 28 msec 24 msec
我们发现路由并没有如我们预期的一样到达R3时直接把包发往R1。究其原因,Cisco设备没有下一跳RTE
下一跳RTE格式如RFC描述:
The next hop Route Table Entry (RTE) has the following format:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
~ IPv6 next hop address (16) ~
| |
+---------------------------------------------------------------+
| must be zero (2) |must be zero(1)| 0xFF |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Specifying a value of 0:0:0:0:0:0:0:0 in the prefix field of a next
hop RTE indicates that the next hop address should be the originator
of the RIPng advertisement. An address specified as a next hop must
be a link-local address.
抓包可见没有该RTE
试验完成