GNS3、secureCRT
RIP是应用层协议,基于UDP端口520
将拓扑搭建成如图所示,并为其每个接口设置ip地址,每个路由器创建换回接口如图所示。操作可参见之前博文。
部署RIP协议
R1配置命令
R1(config)#router rip
R1(config-router)#network 12.0.0.0
R1(config-router)#network 1.0.0.0
R1(config-router)#network 22.0.0.0
R2配置命令
R2(config)#router rip
R2(config-router)#network 12.0.0.0
R2(config-router)#network 2.0.0.0
R2(config-router)#network 32.0.0.0
R3配置命令
R3(config)#router rip
R3(config-router)#network 3.0.0.0
R3(config-router)#network 32.0.0.0
R3(config-router)#network 22.0.0.0
每台路由器都将与自己直连的网段添加进去,由于RIP v1无法识别子网掩码,则直接通过网络数字的大小进行判断,无需输入子网掩码。配置完成后进行测试
测试R1
R1#ping 2.2.2.2 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/40/60 ms
R1#ping 3.3.3.3 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/28/32 ms
R1#ping 32.0.0.2 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 32.0.0.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/47/64 ms
R1#ping 32.0.0.3 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 32.0.0.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/28/32 ms
测试R2
R2#ping 1.1.1.1 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/28/32 ms
R2#ping 3.3.3.3 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/28/36 ms
R2#ping 22.0.0.1 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 22.0.0.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/24/32 ms
R2#ping 22.0.0.2 source 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 22.0.0.2, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/25/32 ms
测试R3
R3#ping 1.1.1.1 source 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/28/32 ms
R3#ping 2.2.2.2 source 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/32/36 ms
R3#ping 12.0.0.1 source 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.1, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/41/64 ms
R3#ping 12.0.0.2 source 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/44/64 ms
可以相互ping通,说明部署成功
排错查看命令:
show run | section router rip // 查看RIP配置
show ip route rip/static/eigrp… // 查看rip/静态/eigrp路由
show ip protocols
将上面拓扑中的R2点击暂停
通过show ip route rip观察时间
180秒时提示信息
240秒之后路由表中已将其删除
再重新开启R2,很快路由表又会重新学习到
在上述拓扑中,将R2暂停会通过计时器更新路由表。
先查看R1的路由
现在将R2的loopback 1 关掉,输入shutdown命令
再查看R1的路由
然后再开启R2的loopback 1,输入no shutdown命令
查看R1的路由
R2关闭环回口,R1可以很快地更新,不需要触发计时器
贝尔曼算法:
1、收到邻居给的路由,若本地没有,则接收
2、收到邻居给的路由,若本地有,则比较度量值,若优则接收,劣则丢弃
3、收到邻居给的路由,若劣质但还是从原来邻居那里收到,也接收
首先关闭A口时,R2的路由表会去除A的路由,然后三十秒后广播自己的路由表。但可能在三十秒内R1把之前从R2学到的通往A的路由发送给R2,此时R2没有去往A的路由就会学习R1发送过来的这条路由。即R2现在认为发往A的数据要发送给R1。
此时网络中有PC如果ping A的话则R1认为要转发给R2,R2认为要转发给R1.此时就形成了一个环路。
1、水平分割:从本接口收到的路由不再从本接口发出去
2、最大16跳:当跳数为16时,会自动丢弃
3、路由中毒:当rip路由出现故障时,会把此路由标记为16跳然后发送给邻居
4、毒性逆转:邻居收到16跳的故障路由会返回16跳的故障路由,实现确认
5、抑制计时器:
RIP v2是无类路由协议可以识别子网掩码
传播路由时夹带子网掩码
组播更新,即只给部署RIP v2协议的路由器发送路由更新信息
由于之前已经部署过RIP v1所以只需要输入一下命令即可
部署命令:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary