RIP(Routing information Protocol,路由信息协议)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,IGP),适用于小型同类网络的一个自治系统(AS)内的路由信息的传递。RIP协议是基于距离矢量算法(Distance Vector Algorithms,DVA)的。它使用“跳数”,即metric来衡量到达目标地址的路由距离。
下面搭建一个简单网络并且开启RIP动态路由协议并配置。
涉及到的配置命令很简单,只有2条 ,
网络拓扑
内容
按照图例:
R1路由器 e0/0接口给ip
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int e0/0
Router(config-if)#no shut
Router(config-if)#
*Mar 26 07:12:57.491: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 26 07:12:58.500: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
Router(config-if)#ip add 192.168.12.1 255.255.255.0
Router(config-if)#exi
Router(config)#exi
Router#
然后配置RIP动态路由
Router(config)#router rip
Router(config-router)#network 192.168.12.0
Router(config-router)#exi
Router(config)#exi
Router#
这个时候去查询路由表是没有的
Router#sh ip rout
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.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Ethernet0/0
L 192.168.12.1/32 is directly connected, Ethernet0/0
依次配置完R2和R3
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host
Router(config)#hostname R2
R2(config)#int e0/0
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
*Mar 26 07:17:06.897: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 26 07:17:07.901: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2(config-if)#exi
R2(config)#router rip
R2(config-router)#exi
R2(config)#int e0/1
R2(config-if)#ip add 192.168.23.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
*Mar 26 07:19:39.300: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
*Mar 26 07:19:40.301: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up
当三个路由器都配置完成之后,就可以查询一下路由表了
R3#sh ip route
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
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
R 192.168.12.0/24 [120/1] via 192.168.23.2, 00:00:09, Ethernet0/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Ethernet0/0
L 192.168.23.3/32 is directly connected, Ethernet0/0
R3#
这里的R就代表RIP 120是管理距离也就是AD值,一般是行业内固定的数值。120后面的1是跳数也叫metric也叫度量值,每跳一个设备就+1,这里和TTL生存时间相关,TTL是每跳1个设备就-1,直到0.都是为了避免无限环路照成网络故障问题而设置的。
AD值
这个时候看看R1的ping通情况,全通了。
以上,RIP动态路由配置完成。主要命令2条 router rip ,network +出接口直连网段,基于UDP协议,端口是520的协议,管理距离 AD值 120 跳数最高16跳,可用检查命令traceroute,sh ip route,ping,show cdp neighbors detail查毗邻接口信息
关键词:RIP动态路由设置(路由器rip动态路由设置)