Chapter 5-Subnetting-Supernetting and Classless Addressing
Short Description
CCNA Mastering IP Subnetting...
Description
Chapter 5 Subnetting/Supernetting and Classless Addressing
Outline o
Subnetting
o
Supernernetting
o
Classless addressing
5.1
SUBNETTING
Subnetting o
IP addresses are designed with two level of hierarchy n
o
Two levels of hierarchy is not enough
Solution: subnetting n
n
A network is divided into several smaller networks Each smaller network is called a subnetw a subnetwork ork or or a subnet
I P addr esses ar e des desi gne gn ed wi th two lle evel vel s of hi ar chy. h i er archy.
Figure 5-1
A N etwor twork k wi with th T wo L evel s of H i er ar arc ch y (n (not ot Su bne bnette tted) d)
Figure 5-2
A N etwor twork k wi with th T h r ee L eve vell s of H i er ar archy chy (Su (Su bne bnette tted) d)
Subn Su bnet etti ting ng (Co Cont nt.) .) o
The subnetw subnetworks orks still appear as a single single network to the rest of the Internet
o
For example, a packet destined for host 141.14.192.2 still reaches router R1
o
However, R1 knows the network 141.14 is physically divided into subnetworks n
It deliver the packet packet to subnetwork subnetwork 141.14.192.0 141.14.192.0
Three Levels of Hierarchy o
Three level n
o
Site, subnet, and host
The routing of an IP datagram now involves three step n
Delivery to the site the site
n
Delivery to the subnetw the subnetwork ork
n
Delivery to the host
Figure 5-3
A ddr ddre esses i n a Ne N etwor k wi with th and wi wi th tho ou t Su Su bne bnetti ttin n g
Subnet Mask o
The network mask create the network address
o
The subnet mask create the subnetwork address
o
Subnet Mask n
Noncontiguous: Noncontiguous: a mixture mixture of 0s and and 1s o
n
Out-of-day
Contiguous: Contiguous: a run of 1s followed by a run of 0s o
In use
Figure 5-5
D ef aul t M as ask k and Su Su bne bnett M as ask k
Finding the Subnet Address o
Given an IP address, we can find the subnet the subnet address in the same way as we found f ound the network address n
o
Apply the mask to the address
Two ways: straight ways: straight or or short-cut short-cut
Straight Method o
Use binary notation for both the address and the mask
o
Then apply the AND operation to find the subnet address
E xample 1
What hat is is th the sub subne netw twor ork k add address ess if if th the destination address is 200.45.34.56 and the subnet mask is 255.255.240.0? 255.255.240.0?
Solution
11001000 00101101 00100010 00111000 11111111 11111111 1111 0000 00000000 11001000 00101101 0010 0000 00000000 The sub subnet networ work k add addres resss is 200.45.32.0.
Short-Cut Method o
If the byte in the mask is 255, copy the th e byte in the address
o
If the byte in the mask is 0, replace rep lace the byte in the address with 0
o
If the byte in the mask is neither 255 2 55 nor 0, we write the mask and the address in binary and apply the AND operation
E xample 2
What What is the the sub subne netw twor ork k addr addres esss if if th the destination address is 19.30.80.5 and the mask is 255.255.192.0? Solution Solution
See Next Figure.
Figure 5-6
E x amp ampll e 2
Default Mask and Subnet Mask o
The number of 1s of 1s in a default mask is perdetermined n
o
8, 16, or 24
But, in a subnet mask, the number of 1s is more than the number of 1s in the corresponding default mask
Figure 5-7
Comp Co mpar arii son of a D ef au l t M as ask k and a Su Su bn bne et M as ask k
Number of Subnetworks o
Found by counting the number of extra bits that are added to the default mask in a subnet mask
o
For example, in above figure n
The number of extra 1s is 3 o
n
The leng length th of subne subnetid tid = 3
The number of subnets is 2^3 = 8
T h e n u mber mber of su bne bn ets mus mu st be bnets a powe powerr of 2.
Number of Addresses per Subnet o
Found by counting the number of 0s of 0s in the subnet mask
o
For example, in above figure n
The number of 0s is 13 o
n
The length length of hostid hostid = 13
The number of addressed in each subnet is 2^13 = 8192
Designing Subnets o
How a network managers design subnets n n n
Deciding the number of subnets Finding the subnet mask Find the range of address in each subnet o
o
o
Start with the first subnet and its first address is the first address in the block Add the number of addresses in each subnet minus one to get the last address Add one to the last address in obtain step to obtain the first address in the next subnet
E xample 3
A company is granted the site address 201.70.64.0 (class C). The company needs six subnets. Design the subnets.
Solution o
o
The number of 1s in the default def ault mask is 24 (class C). The company needs six subnets. n n
o
This number 6 is not a power of 2. The next number that is a power of 2 is 8 (23)
We need 3 more 1s in the subnet mask. n
n
The total number of 1s in the subnet mask is 27 (24 + 3). The total total numb number er of 0s is 5 (32 (32 - 27).
Soluti olu tion on (Conti (Conti nue nu ed)
.
Soluti olu tion on (Conti (Conti nue nu ed)
The mask is 1111111 1111 1111 1 11111111 11111111 1111111 11111111 1 11100000 or 255.255.255.224
The number of subnets is 8. The number of addresses in each subnet is 2 5 (5 is the number of 0s) or 32.
Figure 5-8
E x amp ampll e 3
E xample 4
A company is granted the site address 181.56.0.0 (class B). The company needs 1000 subnets. Design the subnets.
Solution o
o
The number of 1s in the default def ault mask is 16 (class B). The company needs 1000 subnets. n n
o
This number is not a power of 2. The next number that is a power of 2 is 1024 (210).
We need 10 more 1s in the subnet mask. n
n
The total number of 1s in the subnet mask is 26 (16 + 10). The total total numb number er of 0s is 6 (32 (32 - 26).
Soluti olu tion on (Conti (Conti nue nu ed) o
o o
The mask is 11111 11 11111 111 1 11 1111 11111 1111 1 111 11111 1111 111 1 11 11000000 000000 or 255.255.255.192. 255.255 .255.192. The number of subnets is 1024. The number of addresses in each subnet is 26 (6 is the number of 0s) or 64. n
See the Next Figure
Figure 5-9
E x ampl mple e 4
Variable Length Subnetting o
A site that is granted a class C address and have five subnets with the number of hosts n
o
Cannot use a subnet mask with only extra 2 bits n
o
60, 60, 60, 30, 30
Allow only four subnet
Cannot use a subnet make with extra 3 bits n
Eight subnet each with 32 addresses
Variab Var iable le Lengt Length h Subnett Subnetting ing (Co (Cont.) nt.) o
Solution n
o
Variable length subnetting
Use two different masks, one applied after af ter the other n
n
First use the mask with 26 1s (255.255.255.192) to divide the network into four into four subnet subnet Then, apply mask with 27 1s (255.255.255.224) to one of the subnet to divide it into two smaller subnets
Figure 5-10
V ar arii able ble-L -L ength Subn Subne etti ttin n g
5.2
SUPERNETTING
Supernetting o
Class A and B addresses are almost depleted. However, class C addresses are still available
o
But, the size of class block, 256, is too small
o
Solution: subnetting n
Combine several class C blocks to create a larger range of addresses
Figure 5-11
A Su pe perr n etwor twork k
Make a Supernet o
Rules n
n
n
The number of blocks must be a power of 2 (1, 2, 4, 8, 16, . . .) The blocks must be contiguous in the address space (no gaps between the blocks). The third byte of the first the first address address in the superblo superblock ck must must be evenly divisibl divisiblee by the the numb numbeer of blocks. blocks. o
In other words, if the number of blocks is N is N , the third byte must must be divisible by N by N .
E xample 5
A company needs 600 addresses. Which of the following set of class C blocks can be used to to form a superne supernett for this this compan company? y? 198.47. 198. 47.32. 32.0 0 198.47.33. 198.47.33.0 0 198. 198.47. 47.34. 34.0 0 198.47.32.0 198.47. 32.0 198.47. 198.47.42.0 42.0 198.47. 198.47.52.0 52.0 198.47. 198.47.62.0 62.0 198.47.31.0 198.47. 31.0 198.47. 198.47.32.0 32.0 198.47. 198.47.33.0 33.0 198.47. 198.47.52.0 52.0 198.47.32.0 198.47.33.0 198.47.34.0 198.47.35.0
Solution Solution
1: No, there are only three blocks 2^n, 2: No, the blocks are not contiguous. 3: No, 31 in the first block is not divisible by 4. 4: Yes, all three requirements are fulfilled.
Supe Su pern rnet et Ma Mask sk o
In original block of addresses, we know kno w the range of addresses from fro m the first address n
o
Since the mask mask is perdefined (default mask) mask)
In subnetting subnetting or supernett supernetting, ing, the the first address address alone cannot derive the range of addresses n
We need to know the mask , subnet mask or supernet supernet mask, mask, as well. well.
I n subnetting , we n eed the th e f i r st addr ess of the th e su bne bn et and an d the th e su bne bn et mas m ask k to def def i n e th an ge of addr esses. t he r ange
I n supernetting , we n eed the th e f i r st addr ess of t h e supernet a nd the th e supernet mask mask to and def def i n e th e r ange an ge of addr esses. the
Super Sup erne nett Ma Mask sk (C (Cont ont.) .) o
A supernet supernet mask is the reverse reverse of a subnet mask n
A subnet mask has more 1s than the default mask
n
A supernet supernet mask has has less 1s than the default mask mask
Figure 5-12
Compar Comp arii son of Su bne bnet, t, De D ef aul t, and Supe Superr ne nett M asks
E xample 6
We need need to to make make a super supernet netwo work rk out of 16 16 class C blocks. blocks. What is is the super supernet net mask? mask? Solution Solution We need 16 blocks. For 16 blocks we need to change four 1s to 0s in the default mask. So the mask is 11111111 11111111 1111 0000 00000000 Or 255.255.240.0
E xample 7 A supern supernet et has a firs firstt addre address ss of 205.1 205.16. 6.32. 32.0 0 and and a supernet supernet mask mask of 255.255.2 255.255.248. 48.0. 0. A router receives receives three three packets with with the following following destination destination addresses: addresses: 205.16.37.44 205.16.42.56 205.17.33.76 Which packet belongs to the supernet?
Solution
We apply apply the the super supernet net mas mask k to see see if we can can find the beginning address. 205.16.37.44 AND 255.255.248.0
è
205.16.32.0
205.16.42.56 AND 255.255.248.0
è
205.16.40.0
205.17.33.76 AND 255.255.248.0
è
205.17.32.0
Only the first address belongs to this supernet.
E xample 8 A supern supernet et has a first first addres addresss of 205. 205.16. 16.32. 32.0 0 and and a supernet mask of 255.255.248.0. 255.255.248.0. How How many many blocks are in this supernet supernet and what what is the the range of addresses? addresses?
Solution o
Thee super Th superne nett ha hass 21 1s. 1s.
o
The default mask has 24 1s.
o
Since the difference is 3 n
o
There are 23 or 8 blocks in this supernet.
The blocks are 205.16.32.0 to 205.16.39.0. n
The first address is 205.16.32.0.
n
The last address is 205.16.39.255.
5.3
CLASSLESS ADDRESSING
Classless Addressing o
Classful Classful addressing addressing has created created many many problems
o
Solution: classless addressing
o
Idea: variable-length blocks n
The whole address space (2^32 addresses) is divided into blocks of different sizes
Figure 5-13
V ar i abl e-L engt ngth h B l ocks
Number of Addresses in a Block o
There is only one condition on the number of addresses in a block n
o
o o
It must ust be be a powe powerr of of 2 (2, (2, 4, 4, 8, . . .)
A household may be given a block of 2 addresses. A small business may be given 16 addresses. a ddresses. A large organization may be given 1024 addresses
Beginning Addresses o
The beginning address must be evenly divisible by the number of addresses. n
Ex: if a block contains 4 addresses, the beginning address must be divisible by 4.
o
If the block has less than 256 addresses, we need to check only the rightmost byte.
o
If it has less than 65,536 addresses, we need to check only the two rightmost bytes, and so on.
E xample 9 Which of the following can be the beginning address of a block that contains 16 addresses? addresses? 205.16.37.32 190.16.42.44 17.17.33.80 123.45.24.52
Solution Solution
The address 205.16.37.32 is eligible because 32 is divisible by 16. The address 17.17.33.80 is eligible because 80 is divisible by 16.
E xampl e 10 xample Which of the following can be the beginning address of a block that contains 1024 addresses? addresses? 205.16.37.32 190.16.42.0 17.17.32.0 123.45.24.52
Solution
To be divisible by 1024, the rightmost byte of an address should be 0 and the second rightmost byte must be divisible by 4. Only the address 17.17.32.0
Mask o
Like Like the the class classful ful address addressing ing,, subne subnetti tting ng , and and supernetting, in classless addressing, given n n
o
First address address The mask
Then we can define the whole block
Slash Notation o
Attach the number of 1s in a mask to mask to the end of a classless address
o
Also called CIDR (C (C lassless I lassless I nter nter Domain D omain R Routing) outing)
o
The CIDR convey two ideas
o
n
The address is classless
n
Routing is done using interdom interdomain ain routing routing
A mask and a slash followed by a number define the same thing n
The number of common bits in every address in the block
Figure 5-14
Sl as ash h N ota otati ti on
Sl ash ash n otation otati on i s als al so cal ca l l ed call CIDR notation.
Prefix and Suffix o
Prefix n
o
Prefix range: the length of the prefix n
o
Equal to n in the slash notation
Suffix n
o
Another name for the common part of the address range
The varying part of the address range
Suffix range: the length of the suffix n
Equal to (32-n (32-n) in slash notation
E xampl e 11 x ample
A small organization is given a block with the beginning address and the prefix length 205.16.37.24/29 (in slash notation). What is the range of the block?
Solution o
o
o
The beginning address is 205.16.37.24. To find the last address we keep the first 29 bits and change the last 3 bits to 1s. n
Beginning: 11001111 00010000 00100101 00011 000
n
Ending
: 11001111 00010000 00100101 00011 111
There are only 8 addresses in this block.
E xampl e 12 xample We can find the range of addresses in Example 11 by another method. We can argue that the length of the suffix is 32 − 29 or 3. So there are 23 = 8 addresses in this block. If the first address is 205.16.37.24, the last address is 205.16.37.31 (24 + 7 = 31).
A bloc bl ock k i n clas cl ass ses A , B, B , and C can easi asi l y be r epr esen tte ed in i n sl ash ash ted notati notati o n as tion on A .B .C. C.D D / n wher wher e n i s ei the th er 8 (cl ass ass A ), 16 (cl ass ass B ), or 24 (cl ass ass C). C) .
Finding the Network Address o
o
We can derive the network address if we know n
One of the address in the block
n
The prefix The prefix length length,, or a mask , or the suffix the suffix length length
Solution 1 n
o
AND the mask and the address to find the first address, i.e., network address
Solution 2 n
Just keep the first n bits and change change the rest rest to 0s
E xample xampl e 13 13 What is the network address if one of the addresses is 167.199.170.82/27?
Solution o
o o o
o
The prefix length is 27, which means that we must keep the first 27 bits as it is and change the remaining bits (5) to 0s. The 5 bits affect only the last byte. The last byte is 01010010. Changing the last 5 bits to 0s, we get 01000000 or 64. The network address is 167.199.170.64/27.
Subnetting o
We can also use subnetti subnetting ng with classless classless addressing n
o
Just increase the prefix length to derive the subnet prefix length length
See the following example.
E xampl e 14 x ample
An organization is granted the block 130.34.12.64/26. The organization needs to have four subnets. What are the subnet addresses and the range of addresses for each subnet?
Solution o o
The suffix length is 6 (32-26). This means the total number of addresses in the block is 64 64 (2^6).
o
If we create four subnets, each subnet will have 16 addresses.
o
Let us first find the subnet prefix (subnet mask).
o
We need four subnets, which means we need to add two more 1s to the site prefix.
Soluti olu ti on (Conti (Conti nue nu ed) tion
The subnet prefix is then /28. Subnet 1: 130.34.12.64/28 to 130.34.12.79/28. Subnet 2 : 130.34.12.80/28 130 .34.12.80/28 to 130.34.12.95/28. Subnet 3: 130.34.12.96/28 to 130.34.12.111/28. Subnet 4: 130.34.12.112/28 to 130.34.12.127/28. See the Next Figure
Figure 5-15
E x amp ampll e 14
E xampl e 15 xample An ISP is granted a block of addresses starting with 190.100.0.0/16. The ISP needs to distribute these addresses to three groups of customers as follows: 1. The first group has 64 customers; each needs 256 addresses. 2. The second group has 128 customers; each needs 128 addresses. 3. The third group has 128 customers; each needs 64 addresses .
Design the subblocks subblocks and give the slash slash notation notation for each subblock. Find out how many addresses are still available
Solution
Group 1
For this group, each customer needs 256 addresses. This means the suffix length is 8 (2 8 = 256). The prefix length is then 32 − 8 = 24. 01: 190.100.0.0/24
è190.100.0.255/24
02: 190.100.1.0/24
è190.100.1.255/24
………………………………….. 64: 190.100.63.0/24 è190.100.63.255/24 Total
64
256
16,384
Soluti olu tion on (Conti (Conti nue nu ed)
Group 2
For this group, each customer needs 128 addresses. This means the suffix length is 7 (2 7 = 128). The prefix length is then 32 − 7 = 25. The addresses are: 001: 190.100.64.0/25
è190.100.64.127/25
002: 190.100.64.128/25
è190.100.64.255/25
128: 190.100.127.128/25
è190.100.127.255/25
Total = 128 × 128 = 16,384
Soluti olu tion on (Conti (Conti nue nu ed)
Group 3
For this group, each customer needs 64 addresses. This means the suffix length is 6 (2 6 = 64). The prefix length is then 32 − 6 = 26. 001:190.100.128.0/26
è190.100.128.63/26
002:190.100.128.64/26
è190.100.128.127/26
………………………… 128:190.100.159.192/26 è190.100.159.255/26
Soluti olu tion on (Conti (Conti nue nu ed)
Number of granted addresses: 65,536 Number of allocated addresses: 40,960 Number of available addresses: 24,576
Other Issues o
Supernetting n
n
There There is no need for supern supernetti etting ng in classless classless addressing If an organization organization become larger o
o
It may ask a larger block and return the original one
Migration: when the idea of classless addressing come true n
Organization that own class A, B, or C must o o
Use slash notation (/8, /16, /24) Or recycle their block and request a new one
View more...
Comments