RIP (Routing Informantion Protocol)路由信息协议
RIP距离矢量路由协议,RIP用跳数来决定到达某个互联网络的最侍路径。
实验
模拟工具Cisco Packet Tracer
#进入Cisco Packet Tracer 把2811型路由器 拖入工作区
#关闭电源,拖入模块
#搭建拓扑
# 按Ctrl键不放拖动可复制出路由器,不然后加的路由还要重新添加模块
#进入PC1 IP地址配置
#配置IP
Router>
#用户模式
Router>enable
#进入特权模式
Router#configure terminal
#进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
#修改路由器名为R1
R1(config)#interface s0/1/0
#进入s0/1/0接口
R1(config-if)#ip address 192.168.10.1 255.255.255.0
#配置此IP地址
R1(config-if)#no shutdown
#开户端口
#R1与PC1已经可以正常通信
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to down
R1(config-if)#clock rate 64000
#设置DCE端时钟频率
R1#show running-config
#查看当前路由配置
Building configuration...interface Serial0/1/0
interface Serial0/1/0
ip address 192.168.10.1 255.255.255.0
clock rate 64000
shutdown
#同上可以配置出R2、R3、PC2、PC3 IP地址
R1#show ip interface brief
#查看当前路由所有端口信息概况
R1(config-if)#interface f0/0
#进入f0/0接口
R1(config-if)#ip address 1.1.1.1 255.255.255.0
#配置此端口IP
R1(config-if)#no shutdown
#打开端口
R1(config)#router rip
#声明RIP路由协议
R1(config-router)#network 1.0.0.0
R1(config-router)#network 192.168.10.0
#宣告直连网段
R1#show running-config
#查看当前路由配置
Building configuration.
router rip
network 1.0.0.0
network 192.168.10.0
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
C 192.168.10.0/24 is directly connected, Serial0/1/0
R2(config)#route rip
#声明RIP路由协议
R2(config-router)#network 2.1.1.0
R2(config-router)#network 192.168.10.0
R2(config-router)#network 192.168.20.0
#宣告直连网段
R2(config-router)#do show running-config
#查看当前路由配置(在特权模式下不加do)
Building configuration...
Current configuration : 868 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
spanning-tree mode pvst
interface FastEthernet0/0
ip address 2.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/1/0
ip address 192.168.20.1 255.255.255.0
clock rate 64000
router rip
network 2.0.0.0
network 192.168.10.0
network 192.168.20.0
R3(config)#router rip
#声明RIP路由协议
R3(config-router)#network 192.168.20.0
R3(config-router)#network 3.0.0.0
#宣告直连网段
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
R 2.0.0.0/8 [120/1] via 192.168.10.2, 00:00:06, Serial0/1/0
R 3.0.0.0/8 [120/2] via 192.168.10.2, 00:00:06, Serial0/1/0
C 192.168.10.0/24 is directly connected, Serial0/1/0
R 192.168.20.0/24 [120/1] via 192.168.10.2, 00:00:06, Serial0/1/0
R1#show ip protocols
#查看路由选择协议
Routing Protocol is "rip"
#协议名称
Sending updates every 30 seconds, next due in 16 seconds
#每30秒发送一次更新,距下次更新为16秒
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 1 2 1
Serial0/1/0 1 2 1
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
1.0.0.0
192.168.10.0
Passive Interface(s):
Routing Information Sources:
Gateway Distance Last Update
192.168.10.2 120 00:00:28
Distance: (default is 120)
R1#debug ip rip
查看RIP路由更新信息
RIP protocol debugging is on
R1#RIP: received v1 update from 192.168.10.2 on Serial0/1/0
接收到更新信息来自192.168.10.2接口为Serial0/1/0
2.0.0.0 in 1 hops
3.0.0.0 in 2 hops
192.168.20.0 in 1 hops
接收到的路由信息
RIP: sending v1 update to 255.255.255.255 via Serial0/1/0 (192.168.10.1)
发送RIP1版本信息向广播地址经过Serial0/1/0接口
RIP: build update entries
network 1.0.0.0 metric 1
RIP: received v1 update from 192.168.10.2 on Serial0/1/0
2.0.0.0 in 1 hops
3.0.0.0 in 2 hops
192.168.20.0 in 1 hops
R1#undebug all
All possible debugging has been turned off
关闭 debug命令
R1(config-if)#no ip split-horizon
#关闭水平分割(默认为开启,本命令为对比开启与关闭的区别,不能关闭)
RIP protocol debugging is on
R1#RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (1.1.1.1)
RIP: build update entries
network 2.0.0.0 metric 2
network 3.0.0.0 metric 3
network 192.168.10.0 metric 1
network 192.168.20.0 metric 2
RIP: sending v1 update to 255.255.255.255 via Serial0/1/0 (192.168.10.1)
RIP: build update entries
network 1.0.0.0 metric 1
network 2.0.0.0 metric 2
network 3.0.0.0 metric 3
network 192.168.10.0 metric 1
network 192.168.20.0 metric 2
从同一个接口接收到的信息,还是会向同一个发送出去
RIP已配置完成,可用ping 命令验证是全部配通