prácticas de redes de computadores...

15
Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán, Universidad de León 26 de enero de 2012 Resumen Notas complementarias a las prácticas 3 y 4 sobre direccionamiento IP, classful addressing, CIDR y VLSM. Ejemplos de cálculo de direcciones base y de broadcast. Propósito. El objetivo de estas notas consiste en reunir información sobre CIDR y VLSM para estudiantes de Redes de Computadores y ayudarles a realizar ejercicios prácticos de particionamiento y asignación de IPs. Algunos de los ejercicios resueltos están escritos en idioma inglés con el objetivo de que ayuden a los estudiantes a descubrir la terminología relevante y así facilitar su estudio de esta materia, particularmente en lo que se refiere a la lectura del libro de texto en lengua inglesa y otras referencias. 1. Espacios de direccionamiento IP agregados con CIDR. El prefijo CIDR (/n) de una dirección IP es la longitud del bloque de bits 1 contiguos que constituyen su máscara de red, por tanto, al aplicar esta máscara a la IP mediante la función AND bit-a-bit, obtenemos el número de red o prefijo de red. Este número constituye la dirección IP base de un espacio agregado de tamaño 2 32-n y, además, esa dirección está alineada en frontera de 2 32-n . Los proveedores de servicio de internet adquieren espacio IP público en la forma explicada, adquiriendo un espacio agregado CIDR. El proceso de agregar espacio de la forma explicada se le denomina supernetting, ya que se obtienen redes de tamaño progresivamente más grandes. El número (/n) generalmente varía entre 8 (Una red de tipo A) hasta 24 (Una red de tipo C), por tanto, efectivamente CIDR nos permite agregar espacios de IPs de tamaño C (256) correspondientes a prefijos /24. Estudiemos qué ocurre cuando el prefijo CIDR varía. Puesto que el prefijo CIDR marca el número de bits del prefijo de red, si disminuye, aumenta el espacio asignado a las estaciones y, si aumenta, entonces el espacio asignado a las estaciones disminuye. Supongamos que /n aumenta en una unidad /n +1 , el espacio agregado pasa de valer 2 32-n a 2 32-(n+1) , por tanto, hemos dividido por 2 el espacio agregado: 2 32-(n+1) 2 32-n = 1 2 . Al reducir /n en una unidad, ocurre al contrario, el espacio direccionado se ve multiplicado por 2. Ejemplo: Análisis inicial del espacio CIDR agregado 193.163.35.17/20. ---------------- 193.163.35.17/20 (Observad la figura 2) 1

Upload: lyque

Post on 06-Oct-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

Prácticas de Redes de Computadores (2010/11)

Prof. José María Foces Morán, Universidad de León

26 de enero de 2012

Resumen

Notas complementarias a las prácticas 3 y 4 sobre direccionamiento IP, classful addressing, CIDRy VLSM. Ejemplos de cálculo de direcciones base y de broadcast.

Propósito. El objetivo de estas notas consiste en reunir información sobre CIDR y VLSM para estudiantesde Redes de Computadores y ayudarles a realizar ejercicios prácticos de particionamiento y asignación deIPs. Algunos de los ejercicios resueltos están escritos en idioma inglés con el objetivo de que ayuden a losestudiantes a descubrir la terminología relevante y así facilitar su estudio de esta materia, particularmenteen lo que se refiere a la lectura del libro de texto en lengua inglesa y otras referencias.

1. Espacios de direccionamiento IP agregados con CIDR.

El prefijo CIDR (/n) de una dirección IP es la longitud del bloque de bits 1 contiguos que constituyensu máscara de red, por tanto, al aplicar esta máscara a la IP mediante la función AND bit-a-bit, obtenemosel número de red o prefijo de red. Este número constituye la dirección IP base de un espacio agregado detamaño 232−n y, además, esa dirección está alineada en frontera de 232−n. Los proveedores de servicio deinternet adquieren espacio IP público en la forma explicada, adquiriendo un espacio agregado CIDR. Elproceso de agregar espacio de la forma explicada se le denomina supernetting, ya que se obtienen redesde tamaño progresivamente más grandes. El número (/n) generalmente varía entre 8 (Una red de tipoA) hasta 24 (Una red de tipo C), por tanto, efectivamente CIDR nos permite agregar espacios de IPs detamaño C (256) correspondientes a prefijos /24. Estudiemos qué ocurre cuando el prefijo CIDR varía.

Puesto que el prefijo CIDR marca el número de bits del prefijo de red, si disminuye, aumenta elespacio asignado a las estaciones y, si aumenta, entonces el espacio asignado a las estaciones disminuye.Supongamos que /n aumenta en una unidad /n+1 , el espacio agregado pasa de valer 232−n a 232−(n+1),por tanto, hemos dividido por 2 el espacio agregado: 232−(n+1)

232−n = 12 . Al reducir /n en una unidad, ocurre

al contrario, el espacio direccionado se ve multiplicado por 2.

Ejemplo: Análisis inicial del espacio CIDR agregado 193.163.35.17/20.

−−−−−−−−−−−−−−−−193 .163 . 35 . 17/20 ( Observad l a f i g u r a Nº 2)

1

Page 2: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

Figura 1: Espacio de IPs obtenido al variar el prefijo CIDR aplicado a una IP base.

Algoritmo 1 Cálculo de las direcciones BASE y BCAST (Broadcast) de un rango de IPs1. Dirección BASE = IP & MASK2. Dirección BCAST = NOT(MASK) | BASE3. Rango de IPs utilizables = [ BASE + 1, BCAST - 1]4. Número total de IPs utilizables = 232−n. Este espacio está alineado en frontera de 232−n.

−−−−−−−−−−−−−−−−

1 . Número de IPs en e l b l oque :32 − 20 = 12 , 2^12 = 4096

E l número de b l oque s de t i p o C agregados es :Un b loque t i p o C es /24 , por t an to :24 − 20 = 4 , 2^4 = 16 b l oque s C

2

Page 3: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

2 . MASK:/20 = 1111 1111 . 1111 1111 . 1111 0000 . 0000 0000

= 255 . 255 . 240 . 0

3 . BASE :193 . 163 . 0010 0011 . 0001 0001255 . 255 . 1111 0000 . 0000 0000−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− and193 . 163 . 0010 0000 . 0000 0000193 . 163 . 32 . 0

BASE = 193 . 1 63 . 3 2 . 0Esta IP e s t á a l i n e a d a en f r o n t e r a de 2^(32−20) = 4096 IPs

4 . BCAST:193 . 163.0010 0000.0000 0000

0000 0000.0000 0000.0000 1111.1111 1111 = not MASK−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− or

193 . 163.0010 1111.1111 1111193 . 163 . 47 . 255

BCAST = 193 . 163 . 47 . 255

5 . RANGO: [ 1 9 3 . 1 6 3 . 3 2 . 1 , 1 9 3 . 1 6 3 . 4 7 . 2 5 4 ]

2. Particionamiento de un espacio IP agregado en subredes (Sub-netting)

El espacio IP agregado que adquiere una organización habitualmente resulta en una red cuyo tamañoes exageradamente grande, lo cual, ocasionaría problemas de congestión, por ello, será necesario subdividireste espacio en espacios más pequeños. A este proceso se le denomina subnetting se logra aumentandoel prefijo CIDR inicial: un aumento de una unidad produce una división del espacio en 21 espacios iguales,por tanto un aumento de m unidades producirá una división del espacio inicial en 2m espacios, cada unode los cuales tendrá un tamaño de 232−(n+m). Una manipulación simple del espacio obtenido con p bits:2p = 2 · 2p−1 = 2p−1 +2p−1 significa que el espacio correspondiente a p bits bits se puede descomponeren dos espacios iguales de p−1 bits. Trataremos de formular este resultado simple en términos de prefijosCIDR.

Sabemos que a un prefijo /n le corresponde un espacio IP espacioIP (/n) = 232−n, a su vez,si se desea particionar este espacio en dos espacios iguales, según el resultado anterior se tiene que232−n = 232−n−1 + 232−n−1, por tanto, podemos afirmar que: espacioIP (/n) = espacioIP (/n+ 1) +espacioIP (/p+ 1).

En el ejemplo anterior, el espacio plano inicial si se aplica a una red LAN cableada es excesivo,estudiemos su particionamiento en cuatro subredes iguales de tamaño 1024 aplicando el resultado anterior:

3

Page 4: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

El espacio plano adquirido es 193.163.32.0/20:

• espacioIP (/20) = espacioIP (/20 + 1) + espacioIP (/20 + 1)

Obtenemos dos espacios /21, cada uno de los cuales se denomina subred (subnet) y, por tanto,cada uno de ellos tendrá un dirección BASE y BCAST propias. Ambos espacios son contiguos.

4

Page 5: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

Figura 2: Espacio /20 particionado en dos subnets /21

5

Page 6: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

3. Reference exercises

3.1. Una organización adquiere un espacio Ip formado por 16 bloques CIDR clase Ccuya dirección base es 223.150.26.77/20. Las necesidades actuales demandanun particionamiento en subredes con los siguientes tamaños: 1 subnet de almenos 1000, 2 subnets de al menos 500 y otra más de al menos 2000. Propo-ned un esquema de subnetting para esta organización basado en CIDR y VLSM.

Una traducción no literal de este enunciado al inglés: A company purcha-ses an IP addressing space made up of 16 CIDR (C-class) blocks, one of theIP addresses belonging to that space is 223.150.26.77; the CIDR prefix at workis /20. The network administration team is embarking on a network segmen-tation project for the company, the approximate subnet sizes are the following:one 1000-node subnet, two 500-node subnets and one more subnet of a sizeof at least 2000 nodes. Work out a subnetting scheme which, based on VLSMand CIDR satisfies the demanded sizes plus a reasonable future-growth margin.

−−−−−−−−−−−−−−−−223 . 150 . 26 . 77/20−−−−−−−−−−−−−−−−

1 . Número de IPs en e l b l oque :32 − 20 = 12 , 2^12 = 4096

E l número de b l oque s de t i p o C agregados es :Un b loque t i p o C es /24 , por t an to :24 − 20 = 4 , 2^4 = 16 b l oque s C

2 . Algunos p a r t i c i o n am i e n t o s p o s i b l e s : Hemos de a j u s t a r l o s tamañoss o l i c i t a d o s a l a s i g u i e n t e po t e n c i a e n t e r a de 2 , por e jemplo , 1000habrá de a s i g n a r s e a una subnet de tamaño 1024 = 2^10 ( Recordad quee l tamaño e f e c t i v o de e s t a subnet , además , e s 1024 − 2 ( Base y Bcast ) )

a ) 1024512

5122048

b ) 512512

10242048

6

Page 7: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

El p a r t i c i o n am i e n t o s i g u i e n t e no es p o s i b l e porque l a s s ubne t sno e s t án a l i n e a d a s :

5121024512

2048

Por e jemplo , l a segunda (1024) , su IP base (512) no es d i v i s i b l epor su tamaño ( 1024 ) . Usaremos e l esquema a ) .

3 . Pa r t i c i o n a r emo s e l esquema a ) , en p r ime r l u g a r c a l c u l a r emo sl a s IPs BASE y BCAST de l b loque a d q u i r i d o completo :

MASK:/20 = 1111 1111 . 1111 1111 . 1111 0000 . 0000 0000

= 255 . 255 . 240 . 0

4 . BASE :223 . 150 . 0001 1010 . 0100 1101255 . 255 . 1111 0000 . 0000 0000−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− and223 . 150 . 0001 0000 . 0000 0000223 . 150 . 16 . 0

BASE = 223 . 1 50 . 1 6 . 0Esta IP e s t á a l i n e a d a en f r o n t e r a de 2^(32−20) = 4096 IPs

5 . BCAST:223 . 150.0001 0000.0000 0000

0000 0000.0000 0000.0000 1111.1111 1111 = not MASK−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− or

223 . 150.0001 1111.1111 1111223 . 150 . 31 . 255

BCAST = 223 . 150 . 31 . 255

6 . RANGO: [ 2 2 3 . 1 5 0 . 1 6 . 1 , 2 2 3 . 1 5 0 . 3 1 . 2 5 4 ]

7 . A n á l i s i s de l a subnet #0 (1024 , /22 ) :−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

El tamaño ha de s e r 1024 , l a p o t e n c i a e n t e r a de 2 más próx ima

7

Page 8: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

a 1000 por exce so .

l og2 1024 = 10 , 32 − 10 = 22 : e l p r e f i j o para e s t a subnet e s /22 .

Puesto que es l a p r ime ra subnet , tomamos como base l a baseg e n e r a l :

BASE g e n e r a l = 223 .150 .0001 0000.0000 0000/22MASK = f f . f f . 1111 1100.0000 0000−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− andBASE subnet#0 = 223 .150 .0001 0000.0000 0000/22NOT MASK = 00 . 00 .0000 0011.1111 1111−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− orBCAST subnet#0 = 223 .150 .0001 0011.1111 1111

= 223 . 150 . 19 .255

Rango : [ 2 2 3 . 1 5 0 . 1 6 . 1 , 2 2 3 . 1 5 0 . 1 9 . 2 5 4 ]

8 . A n á l i s i s de l a subnet #1 (512 , /23 ) :−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

El tamaño ha de s e r 512 , l a p o t e n c i a e n t e r a de 2 más próx imaa 500 por exce so .

l og2 512 = 9 , 32 − 9 = 23 : e l p r e f i j o para e s t a subnet e s /23 .

Tomamos como base l a d i r e c c i ó n BCAST de l a subnet a n t e r i o r (#0)mas 1 :

= 223 . 150 . 20 . 0MASK = f f . f f . 1111 1110.0000 0000−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− andBASE subnet#1 = 223 . 150 . 20 .0000 0000NOT MASK = 00 . 00 .0000 0001.1111 1111−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− orBCAST subnet#1 = 223 . 150 . 21 .1111 1111

Rango : [ 2 2 3 . 1 5 0 . 2 0 . 1 , 2 2 3 . 1 5 0 . 2 1 . 2 5 4 ]

9 . A n á l i s i s de l a subnet #2 (512 , /23 ) :−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

El tamaño ha de s e r 512 , l a p o t e n c i a e n t e r a de 2 más próx ima

8

Page 9: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

a 500 por exce so .

l og2 512 = 9 , 32 − 9 = 23 : e l p r e f i j o para e s t a subnet e s /23 .

Tomamos como base l a d i r e c c i ó n BCAST de l a subnet a n t e r i o r (#1)mas 1 :

= 223 . 150 . 22 . 0MASK = f f . f f . 1111 1110.0000 0000−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− andBASE subnet#2 = 223 . 150 . 22 .0000 0000NOT MASK = 00 . 00 .0000 0001.1111 1111−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− orBCAST subnet#2 = 223 . 150 . 23 .1111 1111

Rango : [ 2 2 3 . 1 5 0 . 2 2 . 1 , 2 2 3 . 1 5 0 . 2 3 . 2 5 4 ]

9 . A n á l i s i s de l a subnet #3 (2048 , /21 ) :−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

El tamaño ha de s e r 2048 , l a p o t e n c i a e n t e r a de 2 más próx imaa 2000 por exce so .

l og2 2048 = 1 , 32 − 11 = 21 : e l p r e f i j o para e s t a subnet e s /21 .

Tomamos como base l a d i r e c c i ó n BCAST de l a subnet a n t e r i o r (#2)mas 1 :

= 223 . 150 . 24 . 0MASK = f f . f f . 1111 1000.0000 0000−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− andBASE subnet#3 = 223 . 150 . 24 .0000 0000NOT MASK = 00 . 00 .0000 0111.1111 1111−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− orBCAST subnet#3 = 223 . 150 . 31 .1111 1111

= 223 . 150 . 31 . 255

Rango : [ 2 2 3 . 1 5 0 . 2 4 . 1 , 2 2 3 . 1 5 0 . 3 1 . 2 5 4 ]

9

Page 10: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

3.2. Calculate the number of IP addresses contained in the CIDR space 193.146.96.1/20,then, segment that space into four subnets, one of size 1024, two of 512 andone more of size 2048.

The sizes mentioned are to be understood as minimum required sizes and since, in the present case,they are all integer powers of two, clearly we will have to opt, in each case, for the next greater integerpower of two, for example in the 512 case we will have to allocate an effective IP space of 1024.

1. Number of IP addresses contained in the /20 addressing space: 32 − 20 = 12, 212 = 4096 nodesof which we will have to subtract two reserved addresses, the subnet number and the broadcastaddress, as we already know. A more straighforward procedure would consist of conceiving the /20space as made up of several spaces of size /24: 24 spaces of size 256 each since, as mentionedabove, a /24 space is a c-class space, i.e., the 256-node space so familiar to us by now.

2. Let’s calculate now the minimum height power-of-two binary tree that covers the set of sizes given:The set of sizes is S = {4096, 2048, 1024, 1024} and

∑S = 8192, log28192 = 13 therefore, the

minimum CIDR index that covers the set of sizes given is: 32− 13 = 19. We observe that /20, theCIDR index specified in the exercise statement, will not cover completely the set of sizes, thereforewe must choose /19 as our CIDR prefix.

3. As we have proven in the preceeding sections, in order for us to guarantee a partitioning schemewhich partitions are aligned in size-boundary we will perform the address assignment by startingwith the greatest of the sizes and continuing to the smallest, i.e., by choosing each of the sizes innon-increasing order, the partitioning procedure developed next is carried out in this fashion.

4. General (/19) base address (Newtork number):Base address of (193.146.96.1/19) = 193.146.96.1 & 255.255.224.0 = 193.146.96.0

5. General (/19) broadcast address:Base | not(mask) = 193.146.96.0 | (0.0.31.255) = 193.146.127.255Let’s check that the last result is correct by calculating the broadcast address by adding the numberof C blocks that fit into this CIDR space minus 1:The CIDR space size is 2(32−19) = 213 = 8192, this space contains 8192

256 = 32 C-sized blocks,therefore we add 32 to the IP address byte that counts 256-sized blocks, the second signifcantbyte, in the present case the 96:193.146.(96 + 32).0 - 1 = 193.146.128.0 - 1 = 193.146.127.255 which we confirm that is equalto the result obtained above for the general broadcast. Now we will proceed to the partitioningitself and its IP address assignement.

6. Block 4096, net #0, /(32 - 12) = /20, number of C-sized blocks = 16:Network number. This network number conceptually concides with the general base address cal-culated in the previous step: 193.146.96.0/20, no base address calculation is necessary since a /20CIDR space is necessarily aligned on a /19 CIDR space boundary, this statement follows from thefact that any integral power of 2 is divisible by itself and by any other smaller integral power of 2.Broadcast address. 193.146.(96 + 16).0 - 1 = 193.146.112.0 - 1 = 193.146.111.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.96.1,193.146.111.254]

10

Page 11: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

7. Block 2048, net #1, /21, number of C-sized blocks = 8:Network number. This number is calculated by adding 1 to the broadcast address obtained on thelast step: 193.146.111.255 + 1 = 193.146.112.0Broadcast address. Once again we perform this calculation by adding up the current net’s sizeexpressed in terms of c-blocks minus 1 to the current net’s network number, which we do now:193.146.(112 + 8).0 - 1 = 193.146.120.0 - 1 = 193.146.119.255Range: [193.146.112.1, 193.146.119.254]

8. Block 1024, net #2, /22, number of C-sized blocks = 4:Network number. Proceeding as explained in the former subnet we obtain: 193.146.119.255 + 1= 193.146.120.0Broadcast address. 193.146.(120 + 4).0 - 1 = 193.146.124.0 - 1 = 193.146.123.255Range: [193.146.120.1, 193.146.123.254]

9. Block 1024, net #3, /22, number of C-sized blocks = 4:Network number. Proceeding as explained in the former subnet we obtain: 193.146.123.255 + 1= 193.146.124.0Broadcast address. 193.146.(124 + 4).0 - 1 = 193.146.128.0 - 1 = 193.146.127.255, which isequal to the general broadcast address which, in turn, is a check that the calculation is correct,since in this case all the /23 CIDR space has been assigned to the subnets.Range: [193.146.124.1, 193.146.127.254]

3.3. An organization needs IP space for the following maximum subnet sizes: Sizes= {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000}. Calculate the size ofthe minimum aggregated CIDR space that covers S and segment that spaceby using VLSM into an appropriate set of subnets. You must assume a base IPaddress that lays in a public IP range, i.e., one that is not reserved in any way.For each of the subnets compute their base and broadcast addresses togetherwith their IP address range.

1. First we will map each of the sizes to its nearest greater integer power of 2, in each case we willtry to provide for some future growth margin, in the present case we obtain the following nominalsizes S = {256, 256, 512, 512, 1024, 1024, 1024, 1024, 2048, 2048}

2.∑

S = 9728, ceil(log29728) = 14, 214 = 16384 therefore, the minimum CIDR index that coversthe set of sizes given is: 32 − 14 = 18 and, consequently our base CIDR prefix is /18. Since thetotal number of requested IPs (9728) is less than the grand total (16384) for which we will provideCIDR space, there will be a remaining space which we can partition and IP-assign, depending on thespecific network management policies in use -in general our thinking is that it is more appropriateto partition and assign this space from a network security standpoint.

3. If we choose an IP address that belongs to the CIDR space of the previous exercise we may gainsome intuition about the size boundary alignment of IP addresses, let’s choose 193.146.99.133and see what happens when we apply our working mask (That corresponding to our CIDR prefix

11

Page 12: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

of /18). Remember that, in order for us to guarantee that the various blocks get aligned IP baseaddresses we will have to partition the IP space in non increasing order of the nominal sizes S.

4. General (/18) base address (Newtork number):Base address of (193.146.99.133/18) = 193.146.99.133 & 255.255.192.0 = 193.146.64.0This IP must be aligned in its size boundary (232−18 = 16384), i.e., the remainder of the integerdivision of the resulting IP considered as a 32-bit unsigned integer by 16384 must yield zero. Weencourage you to perform the former test by using the IP Java classes and methods writen in theComputer Networks Lab sessions.

5. General (/18) broadcast address:Base | not(mask) = 193.146.64.0 | (0.0.63.255) = 193.146.127.255Let’s check that the last result is correct by calculating the broadcast address by adding the numberof C blocks that fit into this CIDR space minus 1:The CIDR space size is 2(32−18) = 214 = 16384, this space contains 16384

256 = 64 C-sized blocks,therefore we add 64 to the IP address byte that counts 256-sized blocks, the second signifcantbyte, in the present case the 64:193.146.(64 + 64).0 - 1 = 193.146.128.0 - 1 = 193.146.127.255 which we confirm that is equalto the result obtained above for the general broadcast. Now we will proceed to the partitioningitself and its IP address assignement.

6. Block 2048, net #0, /(32 - 11) = /21, number of C-sized blocks = 8:Network number. This network number conceptually concides with the general base address cal-culated in the previous step: 193.146.64.0/18, no base address calculation is necessary since a /21CIDR space is necessarily aligned on a /18 CIDR space boundary, this statement follows from thefact that any integral power of 2 is divisible by itself and by any other smaller integral power of 2.Broadcast address. 193.146.(64 + 8).0 - 1 = 193.146.72.0 - 1 = 193.146.71.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.64.1,193.146.71.254]

7. Block 2048, net #1, /(32 - 11) = /21, number of C-sized blocks = 8:Network number. 193.146.71.255 + 1 = 193.146.72.0Broadcast address. 193.146.(72 + 8).0 - 1 = 193.146.80.0 - 1 = 193.146.79.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.72.1,193.146.79.254]

8. Block 1024, net #2, /(32 - 10) = /22, number of C-sized blocks = 4:Network number. 193.146.79.255 + 1 = 193.146.80.0Broadcast address. 193.146.(80 + 4).0 - 1 = 193.146.84.0 - 1 = 193.146.83.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.80.1,193.146.83.254]

9. Block 1024, net #3, /(32 - 10) = /22, number of C-sized blocks = 4:Network number. 193.146.83.255 + 1 = 193.146.84.0Broadcast address. 193.146.(84 + 4).0 - 1 = 193.146.88.0 - 1 = 193.146.87.255

12

Page 13: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.84.1,193.146.87.254]

10. Block 1024, net #4, /(32 - 10) = /22, number of C-sized blocks = 4:Network number. 193.146.87.255 + 1 = 193.146.88.0Broadcast address. 193.146.(88 + 4).0 - 1 = 193.146.92.0 - 1 = 193.146.91.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.88.1,193.146.91.254]

11. Block 1024, net #5, /(32 - 10) = /22, number of C-sized blocks = 4:Network number. 193.146.91.255 + 1 = 193.146.92.0Broadcast address. 193.146.(92 + 4).0 - 1 = 193.146.96.0 - 1 = 193.146.95.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.92.1,193.146.95.254]

12. Block 512, net #6, /(32 - 9) = /23, number of C-sized blocks = 2:Network number. 193.146.95.255 + 1 = 193.146.96.0Broadcast address. 193.146.(96 + 2).0 - 1 = 193.146.98.0 - 1 = 193.146.97.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.96.1,193.146.97.254]

13. Block 512, net #7, /(32 - 9) = /23, number of C-sized blocks = 2:Network number. 193.146.97.255 + 1 = 193.146.98.0Broadcast address. 193.146.(98 + 2).0 - 1 = 193.146.100.0 - 1 = 193.146.99.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.98.1,193.146.99.254]

14. Block 256, net #8, /(32 - 8) = /24, number of C-sized blocks = 1:Network number. 193.146.99.255 + 1 = 193.146.100.0Broadcast address. 193.146.(100 + 1).0 - 1 = 193.146.101.0 - 1 = 193.146.100.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.100.1,193.146.100.254]

15. Block 256, net #9, /(32 - 8) = /24, number of C-sized blocks = 1:Network number. 193.146.100.255 + 1 = 193.146.101.0Broadcast address. 193.146.(101 + 1).0 - 1 = 193.146.102.0 - 1 = 193.146.101.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.101.1,193.146.101.254]

16. In this exercise we will leave the remaining space unassigned, i.e., the space that starts at 193.146.102.0and ends at the general broadcast address minus one:The unasssigned space is [193.146.102.0, 193.146.127.254]. We leave as an exercise to resolve thisassignment, you must take into account that since its start address is aligned on a /24 boundarywe will always be able to partition this space into a certain number of /24-sized blocks, obviouslythat approach will produce an unacceptably large number of c-blocks in this case, nevertheless wewill collpase 2 properly aligned /24-blocks into an /25 block and successively until all the space isconsumed.

13

Page 14: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

3.4. An organization needs IP space for the following maximum subnet sizes: Sizes= {30, 50, 80, 100, 200, 300}. Calculate the size of the minimum aggregatedCIDR space that covers S and segment that space by using VLSM into anappropriate set of subnets. You must assume a base IP address that lays ina public IP range, i.e., one that is not reserved in any way. For each of thesubnets compute their base and broadcast addresses together with their IPaddress range.

1. First we will map each of the sizes to its nearest greater integer power of 2, in each case we willtry to provide for some future growth margin, in the present case we obtain the following nominalsizes S = {64, 128, 128, 256, 512, 512}

2.∑

S = 1600, ceil(log21600) = 11, 211 = 2048 therefore, the minimum CIDR index that coversthe set of sizes given is: 32−11 = 21 and, consequently our base CIDR prefix is /21. Since the totalnumber of requested IPs (1600) is less than the grand total (2048) for which we will provide CIDRspace, there will be a remaining space which we can partition and IP-assign, depending on thespecific network management policies in use -in general our thinking is that it is more appropriateto partition and assign this space from a network security standpoint.

3. If we choose an IP address that belongs to the CIDR space of the previous exercise we may gainsome intuition about the size boundary alignment of IP addresses, let’s choose 193.146.99.133and see what happens when we apply our working mask (That corresponding to our CIDR prefixof /21). Remember that, in order for us to guarantee that the various blocks get aligned IP baseaddresses we will have to partition the IP space in non increasing order of the nominal sizes S.

4. General (/21) base address (Newtork number):Base address of (193.146.99.133/21) = 193.146.99.133 & 255.255.248.0 = 193.146.96.0This IP must be aligned in its size boundary (232−21 = 2048), i.e., the remainder of the integerdivision of the resulting IP considered as a 32-bit unsigned integer by 2048 must yield zero. Weencourage you to perform the former test by using the IP Java classes and methods writen in theComputer Networks Lab sessions.

5. General (/21) broadcast address:Base | not(mask) = 193.146.96.0 | (0.0.7.255) = 193.146.103.255Let’s check that the last result is correct by calculating the broadcast address by adding the numberof C blocks that fit into this CIDR space minus 1:The CIDR space size is 2(32−21) = 211 = 2048, this space contains 2048

256 = 8 C-sized blocks,therefore we add 8 to the IP address byte that counts 256-sized blocks, the second signifcant byte,in the present case the 96:193.146.(96 + 8).0 - 1 = 193.146.104.0 - 1 = 193.146.103.255 which we confirm that is equal tothe result obtained above for the general broadcast. Now we will proceed to the partitioning itselfand its IP address assignement.

6. Block 512, net #0, /(32 - 9) = /23, number of C-sized blocks = 2:Network number. This network number conceptually concides with the general base address cal-culated in the previous step: 193.146.96.0/21, no base address calculation is necessary since a /23

14

Page 15: Prácticas de Redes de Computadores (2010/11)paloalto.unileon.es/cn/notes/CN-NotesOnVLSMandCIDR.pdf · Prácticas de Redes de Computadores (2010/11) Prof. José María Foces Morán,

CIDR space is necessarily aligned on a /21 CIDR space boundary.Broadcast address. 193.146.(96 + 2).0 - 1 = 193.146.98.0 - 1 = 193.146.97.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.96.1,193.146.97.254]

7. Block 512, net #1 /(32 - 9) = /23, number of C-sized blocks = 2:Network number. 193.146.97.255 + 1 = 193.146.98.0Broadcast address. 193.146.(98 + 2).0 - 1 = 193.146.100.0 - 1 = 193.146.99.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.98.1,193.146.99.254]

8. Block 256, net #2 /(32 - 9) = /24, number of C-sized blocks = 1:Network number. 193.146.99.255 + 1 = 193.146.100.0Broadcast address. 193.146.(100 + 1).0 - 1 = 193.146.101.0 - 1 = 193.146.100.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.100.1,193.146.100.254]

9. Block 128, net #3 /(32 - 7) = /25, number of C-sized blocks = half a C block (128 addresses):Network number. 193.146.100.255 + 1 = 193.146.101.0Broadcast address. 193.146.101.0 + 128 - 1 = 193.146.101.127The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.101.1,193.146.100.126]

10. Block 128, net #4 /(32 - 7) = /25, number of C-sized blocks = half a C block (128 addresses):Network number. 193.146.101.127 + 1 = 193.146.101.128Broadcast address. 193.146.101.128 + 128 - 1 = 193.146.101.255The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.101.129,193.146.100.255]

11. Block 64, net #5 /(32 - 6) = /26, number of C-sized blocks = a quarter of a C block (64addresses):Network number. 193.146.101.255 + 1 = 193.146.102.0Broadcast address. 193.146.102.0 + 64 - 1 = 193.146.102.63The range of IPs allocatable to end nodes is: [BASE + 1, BROADCAST - 1] = [193.146.102.1,193.146.102.63]

4. Closing comments.

In addition to the partitioning algorithm outlined in these notes, obviously, there exist other proceduresto carry out the partitioning and assignment that comply with the alignment requirement, we could setout to seek partitioning algorithms that might offer more flexibility when subnetworks overflow theirassigned size and we want to join two of them without renumbering, for instance. There may be other,more efficient algorithms but our aim here is to offer you an initial, simple and proven procedure thatwill help you prepare for the IP subnetting cases that often appear in term papers and tests. Any errorsor suggestions may be reported to the author at [email protected], thank you.

15