Router>
Router>en
Router#conf t
Router(config)#host r1
r1(config)#int e0
r1(config-if)#ip add 172.16.1.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#int s0
r1(config-if)#ip add 172.16.2.1 255.255.255.0
r1(config-if)#no shutdown
r1(config-if)#clock rate 56000
r1(config-if)#no shutdown
r1(config-if)#exit
r1(config)#router rip
r1(config-router)#net 172.16.0.0
r1(config-router)#^Z
RIP协议启用前的路由表
r1#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
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, * - candidate default
U - per-user static route
Gateway of last resort is not set
C 172.16.1.0/24 is directly connected, Ethernet0
C 172.16.2.0/24 is directly connected, Serial0
RIP协议启用后的路由表
r1#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
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, * - candidate default
U - per-user static route
Gateway of last resort is not set
C 172.16.1.0/24 is directly connected, Ethernet0
C 172.16.2.0/24 is directly connected, Serial0
R 172.16.3.0/24 [120/1] via 172.16.2.2, 00:01:37, Serial0
R 172.16.4.0/24 [120/1] via 172.16.2.2, 00:07:21, Serial0
R 172.16.5.0/24 [120/2] via 172.16.2.2, 00:05:21, Serial0
2. R2上的配置:
Router>
Router>en
Router#conf t
Router(config)#host r2
r2(config)#int s1
r2(config-if)#ip add 172.16.2.2 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#int s0
r2(config-if)#ip add 172.16.4.0 255.255.255.0
r2(config-if)#ip add 172.16.4.1 255.255.255.0
r2(config-if)#clock rate 56000
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#int e0
r2(config-if)#ip add 172.16.3.1 255.255.255.0
r2(config-if)#no shutdown
r2(config-if)#exit
r2(config)#router rip
r2(config-router)#net 172.16.0.0
r2(config-router)#^Z
r2#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
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, * - candidate default
U - per-user static route
Gateway of last resort is not set
C 172.16.2.0/24 is directly connected, Serial1
C 172.16.3.0/24 is directly connected, Ethernet0
C 172.16.4.0/24 is directly connected, Serial0
R 172.16.1.0/24 [120/1] via 172.16.2.1, 00:09:13, Serial1
R 172.16.5.0/24 [120/1] via 172.16.4.2, 00:09:13, Serial0
3. R3上的配置:
Router>
Router>en
Router#conf t
Router(config)#int s1
Router(config-if)#ip add 172.16.4.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int e0
Router(config-if)#ip add 172.16.5.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#host r3
r3(config)#
r3(config)#router rip
r3(config-router)#net 172.16.0.0
r3(config-router)#^Z
r3#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
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, * - candidate default
U - per-user static route
Gateway of last resort is not set
C 172.16.4.0/24 is directly connected, Serial1
C 172.16.5.0/24 is directly connected, Ethernet0
R 172.16.1.0/24 [120/1] via 172.16.4.1, 00:05:32, Serial1
R 172.16.2.0/24 [120/1] via 172.16.4.1, 00:08:19, Serial1
R 172.16.3.0/24 [120/1] via 172.16.4.1, 00:05:32, Serial1
4. 测试:
r1#
r1#ping
Protocol [ip]:
Target IP address: 172.16.5.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.5.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
PC 上的配置为:
PC1:IP为172.16.1.2 网关:172.16.1.1
PC2:IP为172.16.3.2 网关:172.16.3.1
PC3:IP为172.16.5.2 网关:172.16.5.1