HCNA-24 配置RIP的版本兼容、定时器及协议优先级
1、基本配置和RIP协议,R1用RIPv1,R2用RIPv2 <Huawei>system-view [Huawei]sysnamer1 [r1]interfaceGigabitEthernet 0/0/0 [r1-GigabitEthernet0/0/0]ip address 172.16.10.1 24 [r1-GigabitEthernet0/0/0]quit [r1]interface GigabitEthernet 0/0/2 [r1-GigabitEthernet0/0/2]ip address 192.168.10.1 24 [r1-GigabitEthernet0/0/2]quit [r1]rip1 [r1-rip-1]network172.16.0.0 [r1-rip-1]network192.168.10.0 [r1-rip-1]quit <Huawei>system-view [Huawei]sysname r2 [r2]interface GigabitEthernet 0/0/0 [r2-GigabitEthernet0/0/0]ip address 172.16.10.2 24 [r2-GigabitEthernet0/0/0]quit [r2]interface GigabitEthernet 0/0/2 [r2-GigabitEthernet0/0/2]ip address 192.168.20.1 24 [r2-GigabitEthernet0/0/2]quit [r2]rip1 [r2-rip-1]version2 [r2-rip-1]network192.168.20.0 [r2-rip-1]network 172.16.0.0 [r2-rip-1]quit 查看R1与R2的路由表 <r1>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 192.168.20.0/24 RIP 100 1 D 172.16.10.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 <r2>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.10.0/24 Direct 0 0 D 172.16.10.2 GigabitEthernet 0/0/0 172.16.10.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 172.16.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.20.0/24 Direct 0 0 D 192.168.20.1 GigabitEthernet 0/0/2 192.168.20.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.20.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 目前发现,R1可以接收到R2下的192.168.20.0/24路由条目,但R2无法接收到R1的。
可以观察到R1采用了RIPv1,使用的广播方式发送更新。
再观察到R2采用的RIPv2使用的组播方式发送更新 以上验证了R1在RIP协议进程中没有明确指定版本配置时,默认是可处理接收V1和V2版本的报文,但仅发送V1的报文;而R2因为在RIP协议进程明确了V2版本,所以仅接受和发送V2版本的报文。 下面配置兼容 [r1]interfaceGigabitEthernet 0/0/0 [r1-GigabitEthernet0/0/0]ripversion 2 broadcast //接口下配置RIP版本2 广播 也可以配置多播形式,效果一样 [r1-GigabitEthernet0/0/0]ripversion 2 multcast //接口下配置RIP版本2 多播 再次查看路由表 <r2>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 192.168.10.0/24 RIP 100 1 D 172.16.10.1 GigabitEthernet 0/0/0 …… 此时R2能够正常接收到R1的路由表。 这样的兼容化操作,一般不建议用到实际工作中,正常参与RIP协议计算的路由器统一配置相同的RIP版本。
2、RIP的定时器 默认情况下:RIP协议会每隔30s左右发送一次更新。 路由更新的有效期为超时定时器定义的时间:180s。即当在180s内没有收到新的路由更新,则宣布该路由不可达,并从路由表中清除此路由条目。 下面配置R1 GE0/0/0停止发送RIP路由更新 [r1]interfaceGigabitethernet 0/0/0 [r1-GigabitEthernet0/0/0]undorip output //接口配置取消RIP更新 此时立刻查看R2的路由表 <r2>displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 172.16.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.10.0/24 RIP 100 1 D 172.16.10.1 GigabitEthernet 0/0/0 …… 目前R2接收到的R1路由条目仍然存在。 当超过180s时 [r2]displayrip 1 database --------------------------------------------------- Advertisement State : [A] - Advertised [I] - NotAdvertised/Withdraw --------------------------------------------------- 172.16.0.0/16, cost 0, ClassfulSumm 172.16.10.0/24, cost 0, [A],Rip-interface 192.168.10.0/24, cost 16, ClassfulSumm 192.168.10.0/24, cost 16, [I], nexthop 172.16.10.1 //16跳即为不可达,A代表正常宣告,I代表失效+ 192.168.20.0/24, cost 0, ClassfulSumm 192.168.20.0/24, cost 0, [A], Rip-interface [r2]displayrip 1 database --------------------------------------------------- Advertisement State : [A] - Advertised [I] - NotAdvertised/Withdraw --------------------------------------------------- 172.16.0.0/16, cost 0, ClassfulSumm 172.16.10.0/24, cost 0, [A],Rip-interface 192.168.20.0/24, cost 0, ClassfulSumm 192.168.20.0/24, cost 0, [A], Rip-interface RIP1数据库被完清除。 [r2]displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.10.0/24 Direct 0 0 D 172.16.10.2 GigabitEthernet 0/0/0 172.16.10.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 172.16.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.20.0/24 Direct 0 0 D 192.168.20.1 GigabitEthernet 0/0/2 192.168.20.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.20.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 再次查看IP路由表,里面已经没有了路由条止。 RIP的定时器有三种:更新定时器,默认每30s发送一次更新;超过计时器,默认时间180s,如果在超时计时器内没有收到邻居发来的更新报文,则会把该路由的度量值设置为16,并启动垃圾定时器;垃圾收集定时器,默认时间120s,如果启动了该计时器,那么120s超时以后,路由表会删除该路由表项。 [r1]rip1 [r1-rip-1]timersrip 20 120 60 //配置RIP计时器;更新时间间隔为20s,超时计时器时间为120s;垃圾收集计时器为60s; [r1]displayrip //查看RIP协议 PublicVPN-instance RIP process : 1 RIP version : 1 Preference : 100 Checkzero : Enabled Default-cost : 0 Summary : Enabled Host-route : Enabled Maximum number of balanced paths : 8 Update time : 20sec Age time : 120 sec Garbage-collect time : 60 sec Graceful restart : Disabled BFD : Disabled Silent-interfaces : None …… 需要注意手动调速计时器的合理性,不能更新时间大于失效时间,这样会出故障。
3、配置RIP协议优先级 RIP协议的默认优先级为100 [r1]rip1 [r1-rip-1]preference50 //配置优先级为50 [r1]displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.10.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/2 192.168.20.0/24 RIP 50 1 D 172.16.10.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
|