路由信息协议RIP(Routing Information Protocol)是基于距离矢量算法的路由协议,利用跳数来作为计量标准。
RIP:路由信息协议【动态路由协议】
- 根据AS号分类:RIP属于内部网关协议【IGP】,在一个范围内使用的路由协议
- 距离矢量路由协议:距离就是度量值,矢量就是下一跳
- 按照是否携带子网掩码:RIP可分为,有类路由协议【RIPv1,不携带子网掩码】和无类路由协议【RIPv2】
首先搭建实验拓扑
IP配置这里就忽略了,直接开始配置RIP路由。
1.R1 rip配置
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router rip // 在R1上启动rip路由协议
R1(config-router)#network 10.1.0.0 //宣告网段
这时候我们通过show ip route查看路由表,还是看不到另据的路由信息。
R1#show ip route
Codes: 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 routeGateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
2.R1 rip配置
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router rip
R2(config-router)#network 10.1.0.0
配置好R2的RIP协议后,再返回R1查看路由表,发现多处来一条【R 10.1.2.0 [120/1] via 10.1.1.2, 00:00:06, FastEthernet0/0】路由信息。
R1#show ip route
Codes: 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
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 2 subnets
R 10.1.2.0 [120/1] via 10.1.1.2, 00:00:06, FastEthernet0/0
C 10.1.1.0 is directly connected, FastEthernet0/0
R:RIP
- 10.1.2.0:目标网段
- [120/1]:RIP默认管理距离为120,度量值为1,度量值以跳数来计算,跳数是指当一个路由条目从出接口发出的时候就+1
- 10.1.1.2:下一跳地址=矢量值
- 00:00:11:RIP使用定时器,正常情况下=30s,还有一个hold down=180s
这时候我们在R1上ping 10.1.2.1和10.1.2.2得到结果如下:
R1#ping 10.1.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/13/28 ms
R1#ping 10.1.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
我们在R3上也进行RIP配置后,就可以ping通了。
R3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router rip
R3(config-router)#network 10.1.0.0
R1#ping 10.1.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/28 ms
这里有一个细节,就是我们只要能ping通,就会发现发出去的5个包都是感叹号,这是因为RIP协议配置的时候我们通过network已经宣告了,就不需要再通过ARP进行广播索取了。
以上就是RIP路由的配置方法和路由表的解释。