实验15:RIPv2 手工汇总
1.实验目的
通过本实验可以掌握:
(1)RIPv2 路由的手工汇总
(2)RIPv2 不支持CIDR 汇总
(3)RIPv2 可以传递CIDR 汇总
2.拓扑结构
实验拓扑如图 所示。
3.实验步骤
路由器R1、R2 和R0的配置如下
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r0
r0(config)#no ip do loo
r0(config)#lin c 0
r0(config-line)#logg s
r0(config-line)#exec-t 00
r0(config-line)#exit
r0(config)#int loo 1
r0(config-if)#ip add
*Mar 1 00:04:20.387: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r0(config-if)#ip add 192.168.96.4 255.255.255.0
r0(config-if)#int loo 2
r0(config-if)#ip add 1
*Mar 1 00:04:38.139: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to up
r0(config-if)#ip add 192.168.97.4 255.255.255.0
r0(config-if)#int loo 3
r0(config-if)#ip add 1
*Mar 1 00:04:54.815: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback3, changed state to up
r0(config-if)#ip add 192.168.98.4 255.255.255.0
r0(config-if)#int loo 4
r0(config-if)#ip add 19
*Mar 1 00:05:07.659: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback4, changed state to up
r0(config-if)#ip add 192.168.99.4 255.255.255.0
r0(config-if)#int s0/0
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#no sh
r0(config-if)#
*Mar 1 00:05:38.623: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar 1 00:05:39.623: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r0(config-if)#do sh ip int b
Interface IP-Address OK? Method Status Protocol
Serial0/0 172.16.1.1 YES manual up up
Serial0/1 unassigned YES unset administratively down down
Serial0/2 unassigned YES unset administratively down down
Serial0/3 unassigned YES unset administratively down down
Loopback1 192.168.96.4 YES manual up up
Loopback2 192.168.97.4 YES manual up up
Loopback3 192.168.98.4 YES manual up up
Loopback4 192.168.99.4 YES manual up up
r0(config-if)#do ping 172.16.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/36/64 ms
r0(config-if)#exit
r0(config)#router rip
r0(config-router)#ver 2
r0(config-router)#no auto
r0(config-router)#net 172.16.1.0
r0(config-router)#do sh 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
4.0.0.0/22 is subnetted, 1 subnets
R 4.4.0.0 [120/2] via 172.16.1.2, 00:00:04, Serial0/0
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Serial0/0
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:04, Serial0/0
C 192.168.98.0/24 is directly connected, Loopback3
C 192.168.99.0/24 is directly connected, Loopback4
C 192.168.96.0/24 is directly connected, Loopback1
C 192.168.97.0/24 is directly connected, Loopback2
r0(config-router)#do sh 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
4.0.0.0/22 is subnetted, 1 subnets
R 4.4.0.0 [120/2] via 172.16.1.2, 00:00:15, Serial0/0
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Serial0/0
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:15, Serial0/0
C 192.168.98.0/24 is directly connected, Loopback3
C 192.168.99.0/24 is directly connected, Loopback4
C 192.168.96.0/24 is directly connected, Loopback1
C 192.168.97.0/24 is directly connected, Loopback2
r0(config-router)#net 192.168.96.0
r0(config-router)#net 192.168.97.0
r0(config-router)#net 192.168.98.0
r0(config-router)#net 192.168.99.0
r0(config-router)#exit
r0(config)#int s0/0
r0(config-if)#ip summary-address rip 192.168.96.0 255.255.252.0
Summary mask must be greater or equal to major net
//显示的提示信息表明汇总后的掩码长度必须要大于或等于主类网络的掩码程度,因为
“22<24”,所以不能汇总。所以RIPv2 不支持CIDR 汇总
r0(config-if)#exit
r0(config)#router rip
r0(config-router)#ver 2
r0(config-router)#no net 192.168.99.0
r0(config-router)#no net 192.168.98.0
r0(config-router)#no net 192.168.97.0
r0(config-router)#no net 192.168.96.0
r0(config-router)#exit
解决方案如下
用静态路由发布被汇总的路由,再将静态路由重分布到RIP 网络中
r0(config)#ip route 192.168.96.0 255.255.252.0 null0
r0(config)#router rip
r0(config-router)#ver 2
r0(config-router)#redistribute static //态路由重分布到RIP
r0(config-router)#do sh 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
4.0.0.0/22 is subnetted, 1 subnets
R 4.4.0.0 [120/2] via 172.16.1.2, 00:00:01, Serial0/0
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Serial0/0
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:01, Serial0/0
C 192.168.98.0/24 is directly connected, Loopback3
C 192.168.99.0/24 is directly connected, Loopback4
C 192.168.96.0/24 is directly connected, Loopback1
C 192.168.97.0/24 is directly connected, Loopback2
S 192.168.96.0/22 is directly connected, Null0
r0(config-router)#do wr
Building configuration...
[OK]
r0(c
changed state to down
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r1
r1(config)#no ip do loo
r1(config)#lin c 0
r1(config-line)#logg s
r1(config-line)#exec-t 00
r1(config-line)#exit
r1(config)#int s0/0
r1(config-if)#ip add 172.16.1.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#int s
*Mar 1 00:02:07.587: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar 1 00:02:08.587: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r1(config)#int s0/1
r1(config-if)#ip add 172.16.2.1 255.255.255.0
r1(config-if)#clo r 64000
r1(config-if)#no sh
r1(config-if)#
*Mar 1 00:02:27.907: %LINK-3-UPDOWN: Interface Serial0/1, changed state to up
*Mar 1 00:02:28.907: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r1(config-if)#
*Mar 1 00:02:33.527: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
*Mar 1 00:02:53.555: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
*Mar 1 00:04:13.555: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
*Mar 1 00:05:53.511: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r1(config-if)#exit
r1(config)#router rip
r1(config-router)#ve 2
r1(config-router)#no auto
r1(config-router)#net 172.16.1.0
r1(config-router)#net 172.16.2.0
r1(config-router)#do sh 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
4.0.0.0/22 is subnetted, 1 subnets
R 4.4.0.0 [120/1] via 172.16.2.2, 00:00:21, Serial0/1
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Serial0/0
C 172.16.2.0 is directly connected, Serial0/1
r1(config-router)#do sh 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
4.0.0.0/22 is subnetted, 1 subnets
R 4.4.0.0 [120/1] via 172.16.2.2, 00:00:05, Serial0/1
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Serial0/0
C 172.16.2.0 is directly connected, Serial0/1
R 192.168.96.0/22 [120/1] via 172.16.1.1, 00:00:22, Serial0/0
r1(config-router)#do wr
Building configuration...
[OK]
r1(config-router)#
Router>
Router>EN
Router#CONF T
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ho r2
r2(config)#no ip domain loo
r2(config)#lin c 0
r2(config-line)#logg s
r2(config-line)#exec-t 00
r2(config-line)#exit
r2(config)#int loo 1
r2(config-if)#ip add 19
*Mar 1 00:02:36.447: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r2(config-if)#ip add 4.4.0.4 255.255.255.0
r2(config-if)#int loo 2
r2(config-if)#ip addd
*Mar 1 00:02:53.227: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback2, changed state to up
r2(config-if)#ip add 4.4.1.4 255.255.255.0
r2(config-if)#int loo 3
r2(config-if)#
*Mar 1 00:03:14.543: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback3, changed state to up
r2(config-if)#ip add 4.4.2.4 255.255.255.0
r2(config-if)#int loo 4
r2(config-if)#ip add
*Mar 1 00:03:32.179: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback4, changed state to up
r2(config-if)#ip add 4.4.3.4 255.255.255.0
r2(config-if)#exit
r2(config)#int s0/0
r2(config-if)#ip add 172.16.2.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#
*Mar 1 00:04:12.939: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar 1 00:04:13.939: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r2(config-if)#exit
r2(config)#router rip
r2(config-router)#net 4.0.0.0
r2(config-router)#net 172.16.2.0
r2(config-router)#net 4.0.0.0
r2(config-router)#no net 4.0.0.0
r2(config-router)#no net 172.16.2.0
r2(config-router)#v 2
% Ambiguous command: "v 2"
r2(config-router)#ver 2
r2(config-router)#no auto
r2(config-router)#net 172.16.2.0
r2(config-router)#net 4.0.0.0
r2(config-router)#exit
r2(config)#int s0/0
r2(config-if)#ip summary-address rip 4.4.0.0 255.255.252.0
r2(config-if)#do sh 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
4.0.0.0/24 is subnetted, 4 subnets
C 4.4.0.0 is directly connected, Loopback1
C 4.4.1.0 is directly connected, Loopback2
C 4.4.2.0 is directly connected, Loopback3
C 4.4.3.0 is directly connected, Loopback4
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.2.0 is directly connected, Serial0/0
r2(config-if)#
r2(config-if)#
r2(config-if)#do sh 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
4.0.0.0/24 is subnetted, 4 subnets
C 4.4.0.0 is directly connected, Loopback1
C 4.4.1.0 is directly connected, Loopback2
C 4.4.2.0 is directly connected, Loopback3
C 4.4.3.0 is directly connected, Loopback4
172.16.0.0/24 is subnetted, 2 subnets
R 172.16.1.0 [120/1] via 172.16.2.1, 00:00:10, Serial0/0
C 172.16.2.0 is directly connected, Serial0/0
R 192.168.96.0/22 [120/2] via 172.16.2.1, 00:00:10, Serial0/0
r2(config-if)#do ping 192.168.96.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.96.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/40/64 ms
r2(config-if)#do wr
Building configuration...
[OK]
r2(config-if)#
通过输出不难看出RIPv2 是可以传递CIDR 汇总信息的。
本文转自gauyanm 51CTO博客,原文链接:http://blog.51cto.com/gauyanm/235791,如需转载请自行联系原作者