配置rip协议
来源:
作者:
时间:2008-05-29
Tag:
点击:
5、在路由器R2、R3、R4上配置rip协议,并且运行版本2,如下设置:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.4.0
R2(config-router)#network 192.168.5.0
R2(config-router)#exit
R2(config)#exit
R2#
*Mar 1 00:21:45.035: %SYS-5-CONFIG_I: Configured from console by console
R2#
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.6.0
R3(config-router)#network 192.168.5.0
R3(config-router)#exit
R3(config)#exit
R3#
*Mar 1 00:22:17.031: %SYS-5-CONFIG_I: Configured from console by console
R3#
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#no auto-summary
R4(config-router)#network 192.168.6.0
R4(config-router)#network 172.16.0.0
R4(config-router)#exit
R4(config)#exit
R4#
*Mar 1 00:22:53.731: %SYS-5-CONFIG_I: Configured from console by console
R4#
6、使用show ip route命令查看各路由器信息:
R1#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 2 subnets
R 172.16.7.0 [120/3] via 192.168.4.2, 00:00:10, Serial1/2
C 172.16.3.0 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial1/2
R 192.168.5.0/24 [120/1] via 192.168.4.2, 00:00:10, Serial1/2
R 192.168.6.0/24 [120/2] via 192.168.4.2, 00:00:10, Serial1/2
R1#
R2#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
R 172.16.7.0 [120/2] via 192.168.5.3, 00:00:00, FastEthernet0/0
C 192.168.4.0/24 is directly connected, Serial1/2
C 192.168.5.0/24 is directly connected, FastEthernet0/0
R 192.168.6.0/24 [120/1] via 192.168.5.3, 00:00:00, FastEthernet0/0
R2#
R3#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
R 172.16.7.0 [120/1] via 192.168.6.4, 00:00:03, Serial1/1
R 192.168.4.0/24 [120/1] via 192.168.5.2, 00:00:23, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, Serial1/1
R3#
R4#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.7.0 is directly connected, FastEthernet0/0
R 192.168.4.0/24 [120/2] via 192.168.6.3, 00:00:11, Serial1/1
R 192.168.5.0/24 [120/1] via 192.168.6.3, 00:00:11, Serial1/1
C 192.168.6.0/24 is directly connected, Serial1/1
R4#
7、在R1上的路由信息中,R1路由器已经学习到其它路由的信息,因为R1是设置版本1的rip路由协议,是可以学习到版本2的路由信息,而版本2只能学习到版本2的路由信息,所以路由器R2、R3、R4没有学习到R1的路由信息,可以使用show ip protocols查看,如所示:
R1#show ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 17 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 1, receive any version
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 1 1 2
Serial1/2 1 1 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
172.16.0.0
192.168.4.0
Routing Information Sources:
Gateway Distance Last Update
192.168.4.2 120 00:00:14
Distance: (default is 120)
R1#
R2#show ip pro
R2#show ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 10 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
Serial1/2 2 2
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
192.168.4.0
192.168.5.0
Routing Information Sources:
Gateway Distance Last Update
192.168.5.3 120 00:00:08
Distance: (default is 120)
R2#
8、为了让路由器R2、R3、R4也能学习到R1的路由信息,只需要在R2的ser1/2端口做如下设置就可以,因为rip路由协议是相邻路由器之间路由信息相互复制,所以只要R2路由器学习到了,其它路由器就能学习到。
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int ser1/2
R2(config-if)#ip rip re
R2(config-if)#ip rip receive v
R2(config-if)#ip rip receive version 1 2
R2(config-if)#exit
R2(config)#exit
R2#
*Mar 1 00:37:27.503: %SYS-5-CONFIG_I: Configured from console by console
R2#
10、再次使用show ip protocols查看:
R2#show ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 24 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2
Serial1/2 2 1 2
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
192.168.4.0
192.168.5.0
Routing Information Sources:
Gateway Distance Last Update
192.168.4.1 120 00:00:22
192.168.5.3 120 00:00:12
Distance: (default is 120)
R2#
11、再次使用show ip route命令时,R2、R3、R4学习到R1的路由信息:
R2#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
R 172.16.7.0/24 [120/2] via 192.168.5.3, 00:00:02, FastEthernet0/0
R 172.16.0.0/16 [120/1] via 192.168.4.1, 00:00:12, Serial1/2
C 192.168.4.0/24 is directly connected, Serial1/2
C 192.168.5.0/24 is directly connected, FastEthernet0/0
R 192.168.6.0/24 [120/1] via 192.168.5.3, 00:00:02, FastEthernet0/0
R2#
R3#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
R 172.16.7.0/24 [120/1] via 192.168.6.4, 00:00:09, Serial1/1
R 172.16.0.0/16 [120/2] via 192.168.5.2, 00:00:18, FastEthernet0/0
R 192.168.4.0/24 [120/1] via 192.168.5.2, 00:00:18, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, Serial1/1
R3#
R4#show ip route
Codes: 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
i - IS-IS, su - IS-IS summary, 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
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.7.0/24 is directly connected, FastEthernet0/0
R 172.16.0.0/16 [120/3] via 192.168.6.3, 00:00:19, Serial1/1
R 192.168.4.0/24 [120/2] via 192.168.6.3, 00:00:19, Serial1/1
R 192.168.5.0/24 [120/1] via 192.168.6.3, 00:00:19, Serial1/1
C 192.168.6.0/24 is directly connected, Serial1/1
R4#
12、测试,真机与R4能互相ping通:
R4#ping 172.16.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 136/253/408 ms
R4#
C:\Documents and Settings\Administrator>ping 172.16.7.4
Pinging 172.16.7.4 with 32 bytes of data:
Reply from 172.16.7.4: bytes=32 time=244ms TTL=252
Reply from 172.16.7.4: bytes=32 time=268ms TTL=252
Reply from 172.16.7.4: bytes=32 time=185ms TTL=252
Reply from 172.16.7.4: bytes=32 time=176ms TTL=252
Ping statistics for 172.16.7.4:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 176ms, Maximum = 268ms, Average = 218ms
C:\Documents and Settings\Administrator>
在R4上使用扩展ping
R4#ping
Protocol [ip]:
Target IP address: 172.16.3.2
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 172.16.7.4
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.2, timeout is 2 seconds:
Packet sent with a source address of 172.16.7.4
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 108/176/256 ms
R4#
0
