基于某种路由协议实现
特点:减少管理任务,占用了网络带宽
路由器之间用来交换信息的语言
跳数、带宽、负载、时延、可靠性、成本
距离-矢量路由选择协议
RIP的基本概念
RIP度量值为跳数
router rip version 1 network 10.0.0.0 network 20.0.0.0
router rip version 2 no auto-summary network 10.0.0.0 network 20.0.0.0
实验文件下载
#-----Router0配置 Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)# Router(config)#interface fa0/1 Router(config-if)#ip addr 10.1.1.254 255.255.255.0 Router(config-if)#no shutdown Router(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up Router(config-if)#exit Router(config)#interface fa0/0 Router(config-if)#ip addr 20.1.1.1 255.255.255.0 Router(config-if)#no shutdown Router(config-if)# %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)#do show ip route Codes: L - local, C - connected, S - static, 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 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 10.1.1.0/24 is directly connected, FastEthernet0/1 L 10.1.1.254/32 is directly connected, FastEthernet0/1 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.1/32 is directly connected, FastEthernet0/0 Router(config-if)#exit Router(config)#router rip Router(config-router)#version 2 Router(config-router)#network 10.0.0.0 Router(config-router)#network 20.0.0.0 Router(config-router)#no auto-summary Router(config-router)#exit Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 10.1.1.0/24 is directly connected, FastEthernet0/1 L 10.1.1.254/32 is directly connected, FastEthernet0/1 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.1/32 is directly connected, FastEthernet0/0 R 30.0.0.0/8 [120/1] via 20.1.1.2, 00:00:17, FastEthernet0/0 R 40.0.0.0/8 [120/2] via 20.1.1.2, 00:00:11, FastEthernet0/0 #-----Router0配置 #-----Router1配置 Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface fa0/0 Router(config-if)#ip addr 20.1.1.2 255.255.255.0 Router(config-if)#no shutdown 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)#interface fa0/1 Router(config-if)#ip addr 30.1.1.1 255.255.255.0 Router(config-if)#no shutdown Router(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up Router(config-if)# %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up Router(config-if)#router rip Router(config-router)#version 2 Router(config-router)#network 20.0.0.0 Router(config-router)#network 30.0.0.0 Router(config-router)#no auto-summary Router(config-router)#exit Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.2/32 is directly connected, FastEthernet0/0 30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 30.1.1.0/24 is directly connected, FastEthernet0/1 L 30.1.1.1/32 is directly connected, FastEthernet0/1 Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 R 10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:20, FastEthernet0/0 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.2/32 is directly connected, FastEthernet0/0 30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 30.1.1.0/24 is directly connected, FastEthernet0/1 L 30.1.1.1/32 is directly connected, FastEthernet0/1 R 40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:12, FastEthernet0/1 Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 R 10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:07, FastEthernet0/0 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.2/32 is directly connected, FastEthernet0/0 30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 30.1.1.0/24 is directly connected, FastEthernet0/1 L 30.1.1.1/32 is directly connected, FastEthernet0/1 R 40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:26, FastEthernet0/1 Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 R 10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:08, FastEthernet0/0 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.2/32 is directly connected, FastEthernet0/0 30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 30.1.1.0/24 is directly connected, FastEthernet0/1 L 30.1.1.1/32 is directly connected, FastEthernet0/1 R 40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:01, FastEthernet0/1 Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 R 10.0.0.0/8 [120/1] via 20.1.1.1, 00:00:10, FastEthernet0/0 20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 20.1.1.0/24 is directly connected, FastEthernet0/0 L 20.1.1.2/32 is directly connected, FastEthernet0/0 30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 30.1.1.0/24 is directly connected, FastEthernet0/1 L 30.1.1.1/32 is directly connected, FastEthernet0/1 R 40.0.0.0/8 [120/1] via 30.1.1.2, 00:00:03, FastEthernet0/1 #-----Router1配置 #-----Router2配置 Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface fa0/1 Router(config-if)#ip addr 30.1.1.2 255.255.255.0 Router(config-if)#no shutdown Router(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up Router(config-if)#exit Router(config)#interface fa0/0 Router(config-if)#ip addr 40.1.1.254 255.255.255.0 Router(config-if)#no shutdown 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)#version 2 Router(config-router)#network 30.0.0.0 Router(config-router)#network 40.0.0.0 Router(config-router)#no auto-summary Router(config-router)#exit Router(config)#do show ip route Codes: L - local, C - connected, S - static, 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 R 10.0.0.0/8 [120/2] via 30.1.1.1, 00:00:03, FastEthernet0/1 R 20.0.0.0/8 [120/1] via 30.1.1.1, 00:00:03, FastEthernet0/1 30.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 30.1.1.0/24 is directly connected, FastEthernet0/1 L 30.1.1.2/32 is directly connected, FastEthernet0/1 40.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 40.1.1.0/24 is directly connected, FastEthernet0/0 L 40.1.1.254/32 is directly connected, FastEthernet0/0 #-----Router2配置 #查看IP路由协议信息 Router(config)#do show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 2 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 2, receive 2 Interface Send Recv Triggered RIP Key-chain FastEthernet0/1 2 2 FastEthernet0/0 2 2 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 10.0.0.0 20.0.0.0 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update 20.1.1.2 120 00:05:50 Distance: (default is 120)