RIP(Routing Information Protocol)是最常使用的内部网关协议(InteriorGateway Protocol)之一,是一种典型的基于D-V 算法的动态路由协议。 通过UDP(User Datagram Protocol)报文交换路由信息,使用跳数(Hop Count)来衡量到达目的地的距离(被称为路由权-Routing cost)。 由于在RIP 中大于或等于16 的跳数被定义为无穷大(即目的网络或主机不 可达),所以RIP 一般用于采用同类技术的中等规模的网络,如校园网及一个地 区范围内的网络,RIP 并非为复杂、大型的网络而设计。
启动RIP,进入RIP 视图: router Rip
关闭RIP: no rip
在指定的网络上使能RIP network{ network-number| all }
在指定的网络上禁用RIP no network{ network-number| all
- Router1:
- Router>enable //进入特权模式
- Router#conf ter //进入全局配置模式
- Enter configuration commands, one per line. End with CNTL/Z.
- Router(config)#int f0/0 //配置Fa0/0 接口
- Router(config-if)#ip add 1.1.1.2 255.255.255.0
- Router(config-if)#no shutdown
- %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
- Router(config-if)#
- %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
- Router(config-if)#exit
- Router(config)#int s0/0/0 //配置串口
- Router(config-if)#ip add 1.1.6.1 255.255.255.0
- Router(config-if)#clock rate 64000
- Router(config-if)#no shutdown
- %LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
- Router(config-if)#exit
- Router(config)#int s0/0/1 //配置串口
- Router(config-if)#ip add 1.1.2.1 255.255.255.0
- Router(config-if)#clock rate 64000
- Router(config-if)#no shutdown
- %LINK-5-CHANGED: Interface Serial0/0/1, changed state to down
- Router(config-if)#exit
- Router(config)#router rip //进入RIP 视图
- Router(config-router)#network 1.0.0.0 //发布直连网络
- Router(config-router)#exit
- Router(config)#exit
- Router#
- %SYS-5-CONFIG_I: Configured from console by console
- Router#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
- Router#
- Router2:
- Router>enable
- Router#conf ter
- Enter configuration commands, one per line. End with CNTL/Z.
- Router(config)#int f0/0
- Router(config-if)#ip add 1.1.5.2 255.255.255.0
- Router(config-if)#no shutdown
- %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)#int s0/0/1
- Router(config-if)#ip add 1.1.2.2 255.255.255.0
- Router(config-if)#clock rate 64000
- Router(config-if)#no shutdown
- %LINK-5-CHANGED: Interface Serial0/0/1, changed state to up
- Router(config-if)#exit
- Router(config)#int s0/0/0
- Router(config-if)#ip add 1.1.3.1 255.255.255.0
- Router(config-if)#clo rate 64000
- Router(config-if)#no shutdown
- %LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
- Router(config-if)#exit
- Router(config)#router rip
- Router(config-router)#network 1.0.0.0
- Router(config-router)#exit
- Router(config)#exit
- Router#
- %SYS-5-CONFIG_I: Configured from console by console
- Router#
- Router#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, 3 subnets
- R 1.1.1.0 [120/1] via 1.1.2.1, 00:00:11, Serial0/0/1
- C 1.1.2.0 is directly connected, Serial0/0/1
- C 1.1.5.0 is directly connected, FastEthernet0/0
- Router#
- Router3:
- Router>en
- Router#conf ter
- Enter configuration commands, one per line. End with CNTL/Z.
- Router(config)#int f0/0
- Router(config-if)#ip add 1.1.4.2 255.255.255.0
- Router(config-if)#no shutdown
- %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)#int s0/0/0
- Router(config-if)#ip add 1.1.6.2 255.255.255.0
- Router(config-if)#clo rate 64000
- Router(config-if)#no shutdown
- Router(config-if)#
- %LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
- Router(config-if)#exit
- Router(config)#int s0/0/1
- Router(config-if)#ip add 1.1.3.2 255.255.255.0
- Router(config-if)#clock rate 64000
- Router(config-if)#no shutdown
- %LINK-5-CHANGED: Interface Serial0/0/1, changed state to up
- Router(config-if)#exit
- Router(config)#router rip
- Router(config-router)#
- %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/1, changed state to up
- Router(config-router)#network 1.0.0.0
- Router(config-router)#exit
- Router(config)#exit
- Router#
- %SYS-5-CONFIG_I: Configured from console by console
- Router#show ip rou
- Router#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, 6 subnets
- R 1.1.1.0 [120/1] via 1.1.6.1, 00:00:02, Serial0/0/0
- R 1.1.2.0 [120/1] via 1.1.6.1, 00:00:02, Serial0/0/0
- [120/1] via 1.1.3.1, 00:00:10, Serial0/0/1
- C 1.1.3.0 is directly connected, Serial0/0/1
- C 1.1.4.0 is directly connected, FastEthernet0/0
- R 1.1.5.0 [120/1] via 1.1.3.1, 00:00:10, Serial0/0/1
- C 1.1.6.0 is directly connected, Serial0/0/0