动态路由协议实验——RIP
什么是RIP
RIP(Routing Information Protocol,路由信息协议)是一种内部网关协议(IGP),是一种动态路由选择协议,用于自治系统(AS)内的路由信息的传递。RIP协议基于距离矢量算法(Bellham-Ford)(DistanceVectorAlgorithms),使用“跳数”(即metric)来衡量到达目标地址的路由距离。应用于OSI的应用层,使用UDP端口号520端口,配置简单。
RIP工作原理
每一个路由器都会维护一个路由表,路由表中每一项是自己到其他路由器的距离,距离即为跳数,每经过一个路由器跳数加1,RIP规定一个路由最多保存15个路由器,所以距离(metric)只能在0-16之内,16表示无限长即不可达,所以RIP只适合使用于小型网络中。
RIP优缺点
好消息快,坏消息慢
要求:使用RIP协议使各个PC之间能够ping通
1、配置各口子
R1
<HUAWEI>sys
[Huawei]interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.1.1.1 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
R2
<HUAWEI>sys
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.1.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 172.16.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/2]display this
[Huawei-GigabitEthernet0/0/2]q
[Huawei]interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 23.1.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
R3
<HUAWEI>sys
interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 23.1.1.3 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
[Huawei]interface g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 10.1.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/2]display this
[Huawei-GigabitEthernet0/0/2]q
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 34.1.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
R4
<HUAWEI>sys
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 34.1.1.4 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 1.1.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
2、配置各PC
PC1
PC2
PC3
PC4
3、配置RIP协议
R1
[Huawei]rip
[Huawei-rip-1]version 2
[Huawei-rip-1]network 192.168.0.0
[Huawei-rip-1]network 12.0.0.0
R2
[Huawei]rip
[Huawei-rip-1]version 2
[Huawei-rip-1]network 192.168.0.0
[Huawei-rip-1]network 12.0.0.0
[Huawei-rip-1]network 172.16.0.0
R3
[Huawei]rip
[Huawei-rip-1]version 2
[Huawei-rip-1]network 23.0.0.0
[Huawei-rip-1]network 34.0.0.0
[Huawei-rip-1]network 10.0.0.0
R4
[Huawei]rip
[Huawei-rip-1]version 2
[Huawei-rip-1]network 34.0.0.0
[Huawei-rip-1]network 1.0.0.0
4、测试连通性
PC1 ping PC2、PC3、PC4
PC2 ping PC3、PC4
PC3 ping PC4