版权声明:如果对大家有帮助,大家可以自行转载的。https://blog.csdn.net/qq_37992321/article/details/84842671
1.技术原理
RIP(Routing Information Protocols,路由信息协议)是应用较早、使用较普遍的 IGP内部网管协议,使用于小型同类网络,是距离矢量协议;
RIP 协议跳数作为衡量路径开销的,RIP 协议里规定最大跳数为 15;跳计数 16 则表示目标不可达。
RIP 协议有两个版本:RIPv1 和 RIPv2,RIPv1 属于有类路由协议,不支持 VLSM,以广播形式进行路由信息的更新,更新周期为 30 秒;RIPv2 属于无类路由协议,支持 VLSM,以组播形式进行路由更细。
RIP 是一个距离矢量的路由协议,它是定期的更新,默认时间30S,也就是说如果刚刚发送过更新,即使网络拓扑发生了变化,路由器也不进行更新,要等待下一个更新周期才发送更新。
2.拓扑图
3.配置PC
PC0
IP: 192.168.1.2
Submask: 255.255.255.0
Gateway: 192.168.1.1
PC1
IP: 192.168.2.2
Submask: 255.255.255.0
Gateway: 192.168.2.1
4.配置交换机
Switch>en
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int f0/10
Switch(config-if)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
Switch(config-if)#int f0/20
Switch(config-if)#switchport access vlan 20
% Access VLAN does not exist. Creating vlan 20
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#show vlan
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip add 192.168.1.1 255.255.255.0
Switch(config-if)#no shu
Switch(config-if)#
Switch(config-if)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#ip add 192.168.3.1 255.255.255.0
Switch(config-if)#no shu
Switch(config-if)#
Switch(config-if)#exit
Switch(config)#ip routing
Switch(config)#router rip
Switch(config-router)#network 192.168.1.0
Switch(config-router)#network 192.168.3.0
Switch(config-router)#version 2
Switch(config-router)#end
Switch#
5.配置router0
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int f0/0
Router(config-if)#no shu
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#ip add 192.168.3.2 255.255.255.0
Router(config-if)#int s2/0
Router(config-if)#ip add 192.168.4.1 255.255.255.0
Router(config-if)#no shu
%LINK-5-CHANGED: Interface Serial2/0, changed state to down
Router(config-if)#
Router(config-if)#clock rate 64000
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 192.168.3.0
Router(config-router)#network 192.168.4.0
Router(config-router)#version 2
Router(config-router)#
6.配置router1
Router>en
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s2/0
Router(config-if)#ip add 192.168.4.2 255.255.255.0
Router(config-if)#no shu
Router(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
Router(config-if)#int f0/0
Router(config-if)#ip add 19
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
2.168.2.1 255.255.255.0
Router(config-if)#no shu
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 192.168.4.0
Router(config-router)#network 192.168.2.0
Router(config-router)#version 2
7.网络测试
PC0 Ping PC1
Ping 192.168.2.2 reply