动态路由RIP
RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hopcount)作为尺度来衡量路由距离,RIP最多支持的跳数为15
实验已验证成功,只是借用拓扑
实验拓扑:
1、ip地址表:
PC1 ip:192.168.10.2/24
Gateway:192.168.10.1
PC2 ip:192.168.40.2/24
Gateway:192.168.30.1
R1 F0/0192.168.10.1/24
R1 S2/0192.168.20.1/24
R2 S2/0192.168.20.2/24
R2 S3/0192.168.30.1/24
R3 F0/0192.168.40.1/24
R3 S2/0192.168.30.2/24
2、
R1的配置:
R1(config)#interfacefastethernet 0/0//进入接口模式
R1(config-if)#ipaddress 192.168.10.1 255.255.255.0 //配置接口地址
R1(config-if)#noshutdown//激活接口
R1(config-if)#exit
R1(config)#interfaceserial 2/0//进入接口模式
R1(config-if)#ipaddress 192.168.20.1 255.255.255.0//配置接口地址
R1(config-if)#noshutdown//激活接口
%LINK-5-CHANGED:Interface Serial2/0, changed state to down
R1(config-if)#exit
R1(config)#routerrip //启用RIP协议
R1(config-router)#network192.168.10.0//通告直连的网段
R1(config-router)#network192.168.20.0//通告直连的网段
R1(config-router)#exit
R1(config)#exit
%SYS-5-CONFIG_I:Configured from console by console
R1#write
Destinationfilename [startup-config]?
Buildingconfiguration...
[OK]
R1#
R2的配置:
R2(config)#interfaceserial 2/0
R2(config-if)#ipaddress 192.168.20.2 255.255.255.0
R2(config-if)#noshutdown
%LINK-5-CHANGED:Interface Serial2/0, changed state to up
R2(config-if)#clockrate 64000
R2(config-if)#
%LINEPROTO-5-UPDOWN:Line protocol on Interface Serial2/0, changed state to up
R2(config-if)#exit
R2(config)#interfaceserial 3/0
R2(config-if)#ipaddress 192.168.30.1 255.255.255.0
R2(config-if)#noshutdown
%LINK-5-CHANGED:Interface Serial3/0, changed state to down
R2(config-if)#clockrate 64000
R2(config-if)#exit
R2(config)#routerip //启用RIP协议
R2(config-router)#network192.168.20.0//通告直连的网段
R2(config-router)#network192.168.30.0//通告直连的网段
R2(config-router)#exit
R2(config)#exit
%SYS-5-CONFIG_I:Configured from console by console
R2#write
Destinationfilename [startup-config]?
Buildingconfiguration...
[OK]
R2#
R3的配置:
R3(config)#interfacefastEthernet 0/0
R3(config-if)#ipaddress 192.168.40.1 255.255.255.0
R3(config-if)#noshutdown
R3(config-if)#exit
R3(config)#interfaceserial 2/0
R3(config-if)#ipaddress 192.168.30.2 255.255.255.0
R3(config-if)#noshutdown
%LINK-5-CHANGED:Interface Serial2/0, changed state to up
R3(config-if)#
%LINEPROTO-5-UPDOWN:Line protocol on Interface Serial2/0, changed state to up
R3(config-if)#exit
R3(config)#routerip
R3(config-router)#network192.168.40.0
R3(config-router)#network192.168.30.0
R3(config-router)#exit
R3(config)#exit
%SYS-5-CONFIG_I:Configured from console by console
R3#write
Destinationfilename [startup-config]?
Buildingconfiguration...
[OK]
R3#
验证配置:
PC1去pingPC2
PC>ping192.168.40.2
Pinging192.168.40.2 with 32 bytes of data:
Reply from192.168.40.2: bytes=32 time=161ms TTL=125
Reply from 192.168.40.2:bytes=32 time=148ms TTL=125
Reply from192.168.40.2: bytes=32 time=132ms TTL=125
Reply from192.168.40.2: bytes=32 time=154ms TTL=125
Ping statistics for192.168.40.2:
Packets: Sent = 4,Received = 4, Lost = 0 (0% loss),
Approximate roundtrip times in milli-seconds:
Minimum = 132ms,Maximum = 161ms, Average = 148ms
PC1和PC2可以通信,说明RIP协议实验成功!
其他rip命令:show ipprotocols //查看IP路由协议配置和统计信息
debug ip rip //查看RIP路由协议的动态更新过程
show ip rip database //查看RIP数据库