拓扑图如下:
依次配置3台路由器启用接口的IP地址信息如下:
路由器R1
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#int fa0/0
R1(config-if)#ip add 192.168.4.1 255.255.255.0
R1(config-if)#no shut
R1(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
R1(config-if)#int se3/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial3/0, changed state to down
R1(config-if)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
%LINK-5-CHANGED: Interface Serial3/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial3/0, changed state to up
R1#
路由器R2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#int se2/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
R2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R2(config-if)#int fa0/0
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R2(config-if)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2#
路由器R3
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#int fa0/0
R3(config-if)#ip add 192.168.2.2 255.255.255.0
R3(config-if)#no shut
R3(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
R3(config-if)#int fa1/0
R3(config-if)#ip add 192.168.3.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R3(config-if)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console
R3#
配置RIP路由:
路由器R1
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#route rip
R1(config-router)#network 192.168.4.0
R1(config-router)#network 192.168.1.0
R1(config-router)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
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
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 !请注意192.168.3.0和192.168.2.0网段没有学习到路由
C 192.168.1.0/24 is directly connected, Serial3/0
C 192.168.4.0/24 is directly connected, FastEthernet0/0
R1#
路由器R2
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#route rip
R2(config-router)#network 192.168.1.0
R2(config-router)#network 192.168.2.0
R2(config-router)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
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
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 !请注意192.168.3.0网段没有学习到路由
C 192.168.1.0/24 is directly connected, Serial2/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R 192.168.4.0/24 [120/1] via 192.168.1.1, 00:00:12, Serial2/0
R2#
路由器R3
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#route rip
R3(config-router)#network 192.168.2.0
R3(config-router)#network 192.168.3.0
R3(config-router)#end
R3#
%SYS-5-CONFIG_I: Configured from console by console
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
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 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:06, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet1/0
R 192.168.4.0/24 [120/2] via 192.168.2.1, 00:00:06, FastEthernet0/0
R3#
回过头来再一次查看路由器R2的路由表
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
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 !请注意所有网段都学习到了路由
C 192.168.1.0/24 is directly connected, Serial2/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:22, FastEthernet0/0
R 192.168.4.0/24 [120/1] via 192.168.1.1, 00:00:19, Serial2/0
R2#
最后回过头来再一次查看路由器R1的路由表
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
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 !请注意所有网段都学习到了路由
C 192.168.1.0/24 is directly connected, Serial3/0
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:06, Serial3/0
R 192.168.3.0/24 [120/2] via 192.168.1.2, 00:00:06, Serial3/0
C 192.168.4.0/24 is directly connected, FastEthernet0/0
R1#
测试路由器配置
在客户端Laptop0上
PC>ping 192.168.3.20
Pinging 192.168.3.20 with 32 bytes of data:
Request timed out.
Request timed out.
Reply from 192.168.3.20: bytes=32 time=1ms TTL=125
Reply from 192.168.3.20: bytes=32 time=3ms TTL=125
Ping statistics for 192.168.3.20:
Packets: Sent = 4, Received = 2, Lost = 2 (50% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 3ms, Average = 2ms
PC>
在客户端Laptop1上
PC>ping 192.168.4.20
Pinging 192.168.4.20 with 32 bytes of data:
Reply from 192.168.4.20: bytes=32 time=1ms TTL=125
Reply from 192.168.4.20: bytes=32 time=2ms TTL=125
Reply from 192.168.4.20: bytes=32 time=1ms TTL=125
Reply from 192.168.4.20: bytes=32 time=1ms TTL=125
Ping statistics for 192.168.4.20:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms
PC>
测试结果表明RIP路由的配置完全正确。