拓扑如图:
配置R0:
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#int lo0
r1(config-if)#ip add 1.1.1.1 255.0.0.0
r1(config-if)#no shut
r1(config-if)#int s1/0
r1(config-if)#ip add 192.168.1.1 255.255.255.0
r1(config-if)#no shut
r1(config-if)#end
r1#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 192.168.1.1 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 1.1.1.1 YES manual up up
r1#
r1#
r1#
r1#
00:01:41: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down
r1#
00:02:31: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
r1#
r1#
r1#
r1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r1(config)#router rip
r1(config-router)#version 2
r1(config-router)#no auto-summary
r1(config-router)#network 1.0.0.0
r1(config-router)#netw
r1(config-router)#network 192.168.1.0
r1(config-router)#end
配置R2:
r2(config)#int s1/0
r2(config-if)#ip add 192.168.1.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#int s1/1
r2(config-if)#ip add 192.168.2.1 255.255.255.0
r2(config-if)#no shut
r2(config-if)#end
00:02:23: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
00:02:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
r2#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 192.168.1.2 YES manual up up
Serial1/1 192.168.2.1 YES manual up up
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
r2#
r2#
r2#
r2#
00:02:51: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to down
r2#
00:03:21: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
r2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/49/72 ms
r2#
r2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
r2(config)#router rip
r2(config-router)#version 2
r2(config-router)#no aut
r2(config-router)#no auto-summary
r2(config-router)#network 192.168.1.0
r2(config-router)#network 192.168.2.0
r2(config-router)#end
配置R3:
r3(config)#int s1/1
r3(config-if)#ip add 192.168.2.2 255.255.255.0
r3(config-if)#no shut
r3(config-if)#int lo0
r3(config-if)#ip
00:03:09: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
00:03:10: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
r3(config-if)#ip add 2.2.2.2 255.0.0.0
r3(config-if)#no shut
r3(config-if)#end
r3#show
00:03:17: %SYS-5-CONFIG_I: Configured from console by console
r3#show ip itb
00:03:19: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
r3#show ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset administratively down down
Serial1/0 unassigned YES unset administratively down down
Serial1/1 192.168.2.2 YES manual up up
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
Loopback0 2.2.2.2 YES manual up up
r3#
r3#
r3#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/66/72 ms
r3#
测试:
r1#debug ip rip
RIP protocol debugging is on
r1#
00:10:49: RIP: sending v2 update to 224.0.0.9 via Serial1/0 (192.168.1.1) 组播呀!
00:10:49: RIP: build update entries
00:10:49: 1.0.0.0/8 via 0.0.0.0, metric 1, tag 0
00:10:49: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)
00:10:49: RIP: build update entries
00:10:49: 2.0.0.0/8 via 0.0.0.0, metric 3, tag 0
00:10:49: 192.168.1.0/24 via 0.0.0.0, metric 1, tag 0
00:10:49: 192.168.2.0/24 via 0.0.0.0, metric 2, tag 0
00:10:49: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses)
00:10:49: RIP: received v2 update from 192.168.1.2 on Serial1/0
00:10:49: 2.0.0.0/8 via 0.0.0.0 in 2 hops
00:10:49: 192.168.2.0/24 via 0.0.0.0 in 1 hops
r1#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 27 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 version 2
Interface Send Recv Triggered RIP Key-chain
Serial1/0 2 2
Loopback0 2 2 和版本1不一样呀!
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
1.0.0.0
192.168.1.0
Routing Information Sources:
Gateway Distance Last Update
192.168.1.2 120 00:00:03
Distance: (default is 120)
现在,我们把中间的路由运行RIP1,
r2(config)#rotuer rip
r2(config-router)#version 1
同时我们,打开检测......
看路由1:
r1#
00:25:18: RIP: ignored v1 packet from 192.168.1.2 (illegal version) 拒绝接收从路由器2发过来的版本1的路由更新数据包了
r1#
00:25:45: RIP: sending v2 update to 224.0.0.9 via Serial1/0 (192.168.1.1) 仍然发送自己版本2的路由更新数据包到每一个接口上
00:25:45: RIP: build update entries
00:25:45: 1.0.0.0/8 via 0.0.0.0, metric 1, tag 0
00:25:45: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)
00:25:45: RIP: build update entries
00:25:45: 192.168.1.0/24 via 0.0.0.0, metric 1, tag 0
00:25:45: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses)
00:25:46: RIP: ignored v1 packet from 192.168.1.2 (illegal version)
同样路由器2上也拒绝路由器1和路由器3发过来的版本2的路由更新包
r2#
00:28:26: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.1.2)
00:28:26: RIP: build update entries
00:28:26: network 192.168.2.0 metric 1
00:28:26: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.2.1)
00:28:26: RIP: build update entries
00:28:26: network 192.168.1.0 metric 1
00:28:26: RIP: ignored v2 packet from 192.168.1.1 (illegal version)
r2#
00:28:39: RIP: ignored v2 packet from 192.168.2.2 (illegal version)
r2#
路由3如同路由1不接受路由2发过来的本为1的路由更新包,于是乎整个网络瘫痪了......
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, 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
C 1.0.0.0/8 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial1/0
那么怎样解决,版本1和2的兼容问题呢?
我们可以在路由1上的接口s1/0上配置允许他接收版本1的路由更新数据包,在路由2的s1/0接口上配置它能接收版本2的路由更新数据包,s1/1上配置成接收版本2的路由更新数据包,在路由3上的s1/1接口上配置能接收版本1的路由更新数据包。或者干脆把每个接口都配置成接收版本1和版本2的模式。
r1#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 15 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 version 2
Interface Send Recv Triggered RIP Key-chain
Serial1/0 2 1
Loopback0 2 2
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
1.0.0.0
192.168.1.0
Routing Information Sources:
Gateway Distance Last Update
192.168.1.2 120 00:00:11
Distance: (default is 120)
r2#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 0 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 1, receive version 1
Interface Send Recv Triggered RIP Key-chain
Serial1/0 1 2
Serial1/1 1 2
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
192.168.1.0
192.168.2.0
Routing Information Sources:
Gateway Distance Last Update
192.168.2.2 120 00:00:26
192.168.1.1 120 00:00:28
Distance: (default is 120)
配置命令为:
例如r1:
r1( config)#interface serial 1/0
r1( config-if)#ip rip receive version 1
r2( config)#interface s1/0
r1( config-if)#ip rip receive version 1 2 // 能接收两个版本的模式
如果对RIP2的汇总有兴趣的话,就顶这篇吧