
配置各路由器:
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname r0
r0(config)#no ip domain-lookup
r0(config)#enable secret cisco
r0(config)#int f0/1
r0(config-if)#ip address 192.168.3.1 255.255.255.0
r0(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
r0(config-if)#exit
r0(config)#int f0/0
r0(config-if)#ip address 192.168.1.1 255.255.255.0
r0(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
r0(config-if)#exit
r0(config)#end
%SYS-5-CONFIG_I: Configured from console by console
r0#write
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip domain-lookup
Router(config)#enable secret cisco
Router(config)#hostname r1
r1(config)#int f0/0
Router(config)#int f0/0
Router(config-if)#ip address 192.168.1.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 f0/1
Router(config-if)#ip address 192.168.2.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)#exit
Router(config)#end
%SYS-5-CONFIG_I: Configured from console by console
Router#write
Building configuration...
[OK]
Router#exit
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname r2
r2(config)#no ip domain-lookup
r2(config)#enable secret cisco
r2(config)#int f0/0
r2(config-if)#ip address 192.168.2.2 255.255.255.0
r2(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
r2(config-if)#exit
r2(config)#int f0/1
r2(config-if)#ip address 192.168.4.1 255.255.255.0
r2(config-if)#no shutdown
r2(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
r2(config-if)#exit
配置rip前 先看下路由表
r0>enable
Password:
r0#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, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/1
配置动态路由RIP
r0#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
r0(config)#router rip
r0(config-router)#network 192.168.3.0
r0(config-router)#network 192.168.1.0
r1#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#router rip
r1(config-router)#network 192.168.1.0
r1(config-router)#network 192.168.2.0
r2#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#router rip
r2(config-router)#network 192.168.2.0
r2(config-router)#network 192.168.4.0
用192.168.3.2 ping 192.168.4.2
PC>ping 192.168.4.2
Pinging 192.168.4.2 with 32 bytes of data:
Reply from 192.168.4.2: bytes=32 time=125ms TTL=125
Reply from 192.168.4.2: bytes=32 time=110ms TTL=125
Reply from 192.168.4.2: bytes=32 time=125ms TTL=125
Reply from 192.168.4.2: bytes=32 time=125ms TTL=125
Ping statistics for 192.168.4.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
查看路由表:
r0#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, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:18, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/1
R 192.168.4.0/24 [120/2] via 192.168.1.2, 00:00:18, FastEthernet0/0
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, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
R 192.168.3.0/24 [120/1] via 192.168.1.1, 00:00:04, FastEthernet0/0
R 192.168.4.0/24 [120/1] via 192.168.2.2, 00:00:14, FastEthernet0/1
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
R 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:17, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R 192.168.3.0/24 [120/2] via 192.168.2.1, 00:00:17, FastEthernet0/0
C 192.168.4.0/24 is directly connected, FastEthernet0/1
r0#debug ip rip
RIP protocol debugging is on
r0#RIP: sending v1 update to 255.255.255.255 via FastEthernet0/0 (192.168.1.1)
RIP: build update entries
network 192.168.3.0 metric 1
RIP: sending v1 update to 255.255.255.255 via FastEthernet0/1 (192.168.3.1)
RIP: build update entries
network 192.168.1.0 metric 1
network 192.168.2.0 metric 2
RIP: received v1 update from 192.168.1.2 on FastEthernet0/0
192.168.2.0 in 1 hops
192.168.4.0 in 2 hops
对属于该网络的所有接口启用RIP,这些接口将开始发送和接收RIP更新
再每30秒一次的RIP路由更新中向其他路由器通告该网络
转载于:https://blog.51cto.com/ckfwy/336074