经常划分子网的企业要注意了,路由器负荷加重。

什么是CIDR,简称无类域间路由

基于VLSM子网划分后引发的路由条目剧增、路由“爆炸”、路由器负担加重。

当网络规模比较小的时候,这个问题看似不是很严重。但是在大的网络中,如果所有的下级网络都做子网拆分,这个时候将会使得核心位置路由器上的路由表变得分厂的庞大。这个数据容量可以达到十几MB或者几百MB,甚至更多!如果一台路由器的路由表有数百MB,那么如果要在路由表中查看到一个具体的路由条目,也就要在几千几万条路由条目中找到一个具体的路由条目,路由的效率就会变得非常低。我们可以在互联网中可以找到一些给我们测试或者查看的核心路由器的路由条目,要下载路由条目需要很长很长的时间。

路由器对路由条目的查找、更新就会变得非常的中,路由器处理数据的能力就会大大下降。这种情况在运营商变得更加可见,对于ipv4日益耗竭的今天,ip地址的不断拆分引来的一个很重大的问题

为了使在大规模的网络中,效率变得更加高,就要使用路由汇总。CIDR和VLSM其实是一个互为逆的运算

以下为实验拓扑

cisco下的RIP路由汇总CIDR实验_第1张图片

 配置好后通过sh ip route,可以看到的是R4路由器有各个子网的路由,而R5路由器却只有一条192.168.49.0/25的汇总路由,所有通过R5去其余R1~R4的路由器均可以以这条RIP路由

R       192.168.49.0 [120/1] via 201.0.0.1, 00:00:02, Serial1/2

      201.0.0.0/24 is variably subnetted, 2 subnets, 2 masks

往出接口S1/2发送数据。这样已达到了减少路由条目,增快查看效率的速度。

路由汇总的关键点,还是在于R4路由器的接口S1/3下配置的命令ip summary-address rip 192.168.49.0 255.255.255.128的效果,还请细细体会。

R1的相关设置:

 

R1#sh run

Building configuration...

 

Current configuration : 1348 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname R1

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

clock timezone CST 8

mmi polling-interval 60

no mmi auto-configure

no mmi pvc

mmi snmp-timeout 180

ip source-route

!

!

ip cef

no ip domain lookup

no ipv6 traffic interface-statistics

no ipv6 cef

!

multilink bundle-name authenticated

!

redundancy

!

interface Loopback0

 ip address 192.168.49.1 255.255.255.224

!

interface Ethernet0/0

 no ip address

 shutdown

!

interface Ethernet0/1

 no ip address

 shutdown

!

interface Ethernet0/2

 no ip address

 shutdown

!

interface Ethernet0/3

 no ip address

 shutdown

!

interface Serial1/0

 no ip address

 shutdown

 no fair-queue

 serial restart-delay 0

!

interface Serial1/1

 no ip address

 shutdown

 serial restart-delay 0

!

interface Serial1/2

 ip address 192.168.49.97 255.255.255.252

 serial restart-delay 0

!

interface Serial1/3

 no ip address

 shutdown

 serial restart-delay 0

!

router rip

 version 2

 network 192.168.49.0

 no auto-summary

!

ip forward-protocol nd

!

!

no ip http server

no ip http secure-server

!

control-plane

!

!

line con 0

 exec-timeout 0 0

 logging synchronous

line aux 0

line vty 0 4

 login

!         

exception data-corruption buffer truncate

end

---------------------------------------------------------------

 

 

R1#sh ip route

Codes: L - local, 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, + - replicated route

 

Gateway of last resort is not set

 

      192.168.49.0/24 is variably subnetted, 8 subnets, 3 masks

C        192.168.49.0/27 is directly connected, Loopback0

L        192.168.49.1/32 is directly connected, Loopback0

R        192.168.49.32/27 [120/2] via 192.168.49.98, 00:00:21, Serial1/2

R        192.168.49.64/27 [120/2] via 192.168.49.98, 00:00:21, Serial1/2

C        192.168.49.96/30 is directly connected, Serial1/2

L        192.168.49.97/32 is directly connected, Serial1/2

R        192.168.49.100/30 [120/1] via 192.168.49.98, 00:00:21, Serial1/2

R        192.168.49.104/30 [120/1] via 192.168.49.98, 00:00:21, Serial1/2

R     201.0.0.0/24 [120/1] via 192.168.49.98, 00:00:21, Serial1/2

R     202.0.0.0/24 [120/2] via 192.168.49.98, 00:00:21, Serial1/2

=================================================================

R2的相关设置:

 

R2#sh run

Building configuration...

 

Current configuration : 1350 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname R2

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

clock timezone CST 8

mmi polling-interval 60

no mmi auto-configure

no mmi pvc

mmi snmp-timeout 180

ip source-route

!

!

ip cef

no ip domain lookup

no ipv6 traffic interface-statistics

no ipv6 cef

!

multilink bundle-name authenticated

!

!

redundancy

!

interface Loopback0

 ip address 192.168.49.33 255.255.255.224

!

interface Ethernet0/0

 no ip address

 shutdown

!

interface Ethernet0/1

 no ip address

 shutdown

!

interface Ethernet0/2

 no ip address

 shutdown

!

interface Ethernet0/3

 no ip address

 shutdown

!

interface Serial1/0

 no ip address

 shutdown

 no fair-queue

 serial restart-delay 0

!

interface Serial1/1

 no ip address

 shutdown

 serial restart-delay 0

!

interface Serial1/2

 ip address 192.168.49.101 255.255.255.252

 serial restart-delay 0

!

interface Serial1/3

 no ip address

 shutdown

 serial restart-delay 0

!

router rip

 version 2

 network 192.168.49.0

 no auto-summary

!

ip forward-protocol nd

!

!

no ip http server

no ip http secure-server

!

!

control-plane

!

!

line con 0

 exec-timeout 0 0

 logging synchronous

line aux 0

line vty 0 4

 login

!         

exception data-corruption buffer truncate

end

 

 

R2#sh ip route

Codes: L - local, 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, + - replicated route

 

Gateway of last resort is not set

 

      192.168.49.0/24 is variably subnetted, 8 subnets, 3 masks

R        192.168.49.0/27 [120/2] via 192.168.49.102, 00:00:14, Serial1/2

C        192.168.49.32/27 is directly connected, Loopback0

L        192.168.49.33/32 is directly connected, Loopback0

R        192.168.49.64/27 [120/2] via 192.168.49.102, 00:00:14, Serial1/2

R        192.168.49.96/30 [120/1] via 192.168.49.102, 00:00:14, Serial1/2

C        192.168.49.100/30 is directly connected, Serial1/2

L        192.168.49.101/32 is directly connected, Serial1/2

R        192.168.49.104/30 [120/1] via 192.168.49.102, 00:00:14, Serial1/2

R     201.0.0.0/24 [120/1] via 192.168.49.102, 00:00:14, Serial1/2

R     202.0.0.0/24 [120/2] via 192.168.49.102, 00:00:14, Serial1/2

=================================================================

R3的相关配置:

 

R3#sh run

Building configuration...

 

Current configuration : 1350 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname R3

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

clock timezone CST 8

mmi polling-interval 60

no mmi auto-configure

no mmi pvc

mmi snmp-timeout 180

ip source-route

!

ip cef

no ip domain lookup

no ipv6 traffic interface-statistics

no ipv6 cef

!

multilink bundle-name authenticated

!

!

redundancy

!

interface Loopback0

 ip address 192.168.49.65 255.255.255.224

!

interface Ethernet0/0

 no ip address

 shutdown

!

interface Ethernet0/1

 no ip address

 shutdown

!

interface Ethernet0/2

 no ip address

 shutdown

!

interface Ethernet0/3

 no ip address

 shutdown

!

interface Serial1/0

 no ip address

 shutdown

 no fair-queue

 serial restart-delay 0

!

interface Serial1/1

 no ip address

 shutdown

 serial restart-delay 0

!

interface Serial1/2

 ip address 192.168.49.105 255.255.255.252

 serial restart-delay 0

!

interface Serial1/3

 no ip address

 shutdown

 serial restart-delay 0

!

router rip

 version 2

 network 192.168.49.0

 no auto-summary

!

ip forward-protocol nd

!

!

no ip http server

no ip http secure-server

!

control-plane

!

!

line con 0

 exec-timeout 0 0

 logging synchronous

line aux 0

line vty 0 4

 login

!         

exception data-corruption buffer truncate

end

 

 

R3#sh ip route

Codes: L - local, 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, + - replicated route

 

Gateway of last resort is not set

 

      192.168.49.0/24 is variably subnetted, 8 subnets, 3 masks

R        192.168.49.0/27 [120/2] via 192.168.49.106, 00:00:11, Serial1/2

R        192.168.49.32/27 [120/2] via 192.168.49.106, 00:00:11, Serial1/2

C        192.168.49.64/27 is directly connected, Loopback0

L        192.168.49.65/32 is directly connected, Loopback0

R        192.168.49.96/30 [120/1] via 192.168.49.106, 00:00:11, Serial1/2

R        192.168.49.100/30 [120/1] via 192.168.49.106, 00:00:11, Serial1/2

C        192.168.49.104/30 is directly connected, Serial1/2

L        192.168.49.105/32 is directly connected, Serial1/2

R     201.0.0.0/24 [120/1] via 192.168.49.106, 00:00:11, Serial1/2

R     202.0.0.0/24 [120/2] via 192.168.49.106, 00:00:11, Serial1/2

 

========================================================

R4的相关配置:

 

R4#sh run

Building configuration...

 

Current configuration : 1389 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname R4

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

clock timezone CST 8

mmi polling-interval 60

no mmi auto-configure

no mmi pvc

mmi snmp-timeout 180

ip source-route

!

ip cef

no ip domain lookup

no ipv6 traffic interface-statistics

no ipv6 cef

!

multilink bundle-name authenticated

!

redundancy

!

interface Ethernet0/0

 no ip address

 shutdown

!

interface Ethernet0/1

 no ip address

 shutdown

!

interface Ethernet0/2

 no ip address

 shutdown

!

interface Ethernet0/3

 no ip address

 shutdown

!

interface Serial1/0

 ip address 192.168.49.98 255.255.255.252

 serial restart-delay 0

!         

interface Serial1/1

 ip address 192.168.49.102 255.255.255.252

 serial restart-delay 0

!

interface Serial1/2

 ip address 192.168.49.106 255.255.255.252

 serial restart-delay 0

!

interface Serial1/3

 ip address 201.0.0.1 255.255.255.0

 ip summary-address rip 192.168.49.0 255.255.255.128

 serial restart-delay 0

!

router rip

 version 2

 network 192.168.49.0

 network 201.0.0.0

 no auto-summary

!

ip forward-protocol nd

!

!

no ip http server

no ip http secure-server

!

!

control-plane

!

!

line con 0

 exec-timeout 0 0

 logging synchronous

line aux 0

line vty 0 4

 login

!

exception data-corruption buffer truncate

end

 

 

R4#sh ip route

Codes: L - local, 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, + - replicated route

 

Gateway of last resort is not set

 

      192.168.49.0/24 is variably subnetted, 9 subnets, 3 masks

R        192.168.49.0/27 [120/1] via 192.168.49.97, 00:00:04, Serial1/0

R        192.168.49.32/27 [120/1] via 192.168.49.101, 00:00:05, Serial1/1

R        192.168.49.64/27 [120/1] via 192.168.49.105, 00:00:08, Serial1/2

C        192.168.49.96/30 is directly connected, Serial1/0

L        192.168.49.98/32 is directly connected, Serial1/0

C        192.168.49.100/30 is directly connected, Serial1/1

L        192.168.49.102/32 is directly connected, Serial1/1

C        192.168.49.104/30 is directly connected, Serial1/2

L        192.168.49.106/32 is directly connected, Serial1/2

      201.0.0.0/24 is variably subnetted, 2 subnets, 2 masks

C        201.0.0.0/24 is directly connected, Serial1/3

L        201.0.0.1/32 is directly connected, Serial1/3

R     202.0.0.0/24 [120/1] via 201.0.0.2, 00:00:19, Serial1/3

 

============================================================

R5的相关配置:

 

R5#sh run

Building configuration...

 

Current configuration : 1353 bytes

!

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname R5

!

boot-start-marker

boot-end-marker

!

!

no aaa new-model

clock timezone CST 8

mmi polling-interval 60

no mmi auto-configure

no mmi pvc

mmi snmp-timeout 180

ip source-route

!

ip cef

no ip domain lookup

no ipv6 traffic interface-statistics

no ipv6 cef

!

multilink bundle-name authenticated

!

redundancy

interface Loopback0

 ip address 202.0.0.1 255.255.255.0

!

interface Ethernet0/0

 no ip address

 shutdown

!

interface Ethernet0/1

 no ip address

 shutdown

!

interface Ethernet0/2

 no ip address

 shutdown

!

interface Ethernet0/3

 no ip address

 shutdown

!

interface Serial1/0

 no ip address

 shutdown

 no fair-queue

 serial restart-delay 0

!

interface Serial1/1

 no ip address

 shutdown

 serial restart-delay 0

!

interface Serial1/2

 ip address 201.0.0.2 255.255.255.0

 serial restart-delay 0

!

interface Serial1/3

 no ip address

 shutdown

 serial restart-delay 0

!

router rip

 version 2

 network 201.0.0.0

 network 202.0.0.0

 no auto-summary

!

ip forward-protocol nd

!

!

no ip http server

no ip http secure-server

!

!

control-plane

!

!

line con 0

 exec-timeout 0 0

 logging synchronous

line aux 0

line vty 0 4

 login    

!

exception data-corruption buffer truncate

end

 

 

 

R5#sh ip route

Codes: L - local, 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, + - replicated route

 

Gateway of last resort is not set

 

      192.168.49.0/25 is subnetted, 1 subnets

R        192.168.49.0 [120/1] via 201.0.0.1, 00:00:11, Serial1/2

      201.0.0.0/24 is variably subnetted, 2 subnets, 2 masks

C        201.0.0.0/24 is directly connected, Serial1/2

L        201.0.0.2/32 is directly connected, Serial1/2

      202.0.0.0/24 is variably subnetted, 2 subnets, 2 masks

C        202.0.0.0/24 is directly connected, Loopback0

L        202.0.0.1/32 is directly connected, Loopback0

 

========================================================

 

R1#ping 202.0.0.1 source 192.168.49.1

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 202.0.0.1, timeout is 2 seconds:

Packet sent with a source address of 192.168.49.1 

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/20/24 ms

 

 

R2#ping 202.0.0.1 source 192.168.49.33

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 202.0.0.1, timeout is 2 seconds:

Packet sent with a source address of 192.168.49.33 

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/18/20 ms

 

 

 

R3#ping 202.0.0.1 source 192.168.49.65

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 202.0.0.1, timeout is 2 seconds:

Packet sent with a source address of 192.168.49.65 

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/19/24 ms

 可以看到的是全网互通!