0% found this document useful (0 votes)
20 views8 pages

IP Addressing and CIDR Examples Guide

The document provides examples and solutions for IP addressing, including calculating the first and last addresses in a block, subnetting, and CIDR block creation. It outlines rules for creating CIDR blocks and demonstrates how to determine if a block is a CIDR block with specific examples. Additionally, it covers CIDR aggregation for multiple IP addresses, explaining the necessary conditions for aggregation.

Uploaded by

ad6mi5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views8 pages

IP Addressing and CIDR Examples Guide

The document provides examples and solutions for IP addressing, including calculating the first and last addresses in a block, subnetting, and CIDR block creation. It outlines rules for creating CIDR blocks and demonstrates how to determine if a block is a CIDR block with specific examples. Additionally, it covers CIDR aggregation for multiple IP addresses, explaining the necessary conditions for aggregation.

Uploaded by

ad6mi5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

IP Addressing Solved Examples

Example 1:
A block of addresses is granted to a small organization. We know that one of the addresses
is [Link]/28.
What is the first address in the block?
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 00100000
or [Link].
Find the last address for the block.
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
Or [Link]
Find the number of addresses
Solution
The value of n is 28, which means that number of addresses is 2 32−28 or 16.
Example 2:
Another way to find the first address, the last address, and the number of addresses is to
represent the mask as a 32-bit binary (or 8-digit hexadecimal) number. This is particularly
useful when we are writing a program to find these pieces of information.
In Example [Link]/28 the /28 can be represented as
11111111 11111111 11111111 11110000 (twenty-eight 1s and four 0s).
Find
a. The first address
b. The last address
c. The number of addresses.

SKK IT CN IP Addressing 1
Solution
a. The first address can be found by ANDing the given addresses with the mask. ANDing
here is done bit by bit. The result of ANDing 2 bits is 1 if both bits are 1s; the result is 0
otherwise.

b. The last address can be found by ORing the given addresses with the complement of the
mask. ORing here is done bit by bit. The result of ORing 2 bits is 0 if both bits are 0s; the
result is 1 [Link] complement of a number is found by changing each 1to 0 and
each 0 to 1.

c. The number of addresses can be found by complementing the mask, interpreting it as a


decimal number, and adding 1 to it.

SKK IT CN IP Addressing 2
Example 3:
A company is granted a site address [Link]. The company needs seven subnets. Design
the subnets.
Solution:
Class C IP address is Given [Link]
Seven subnet has to be design so mask is
11111111 11111111 11111111 11100000 then 7 subnets means 23 =8 (no of extra 1s) and 25 =
32 (no of 0s hosts per subnet).
Subnet 1: [Link] – [Link]
Subnet 2: [Link] – [Link]
Subnet 3: [Link] – [Link]
Subnet 4: [Link] – [Link]
Subnet 5: [Link] – [Link]
Subnet 6: [Link] – [Link]
Subnet 7: [Link] – [Link]

Example 4:
The IP network [Link] is using subnet mask [Link]. Design the subnets.
Solution:
Mask [Link] means by converting in binary 11111111 11111111 11111111 11100000
we find that, 23 =8 (no of extra 1s) and 25 = 32 (no of 0s hosts per subnet).
Subnet 1: [Link] to [Link]
Subnet 2: [Link] to [Link]
Subnet 3: [Link] to [Link]
Subnet 4: [Link] to [Link]
Subnet 5: [Link] to [Link]
Subnet 6: [Link] to [Link]
Subnet 7: [Link] to [Link]
Subnet 8: [Link] to [Link]

SKK IT CN IP Addressing 3
CIDR Example

Rules For Creating CIDR Block-

A CIDR block is created based on the following 3 rules-

Rule-01:
 All the IP Addresses in the CIDR block must be contiguous.

Rule-02:
 The size of the block must be presentable as power of 2.
 Size of the block is the total number of IP Addresses contained in the block.
 Size of any CIDR block will always be in the form 2 1, 22, 23, 24, 25 and so on.

Rule-03:
 First IP Address of the block must be divisible by the size of the block.

CIDR Notation-
CIDR IP Addresses look like a.b.c.d / n
 They end with a slash followed by a number called as IP network prefix.
 IP network prefix tells the number of bits used for the identification of network.
 Remaining bits are used for the identification of hosts in the network.

SKK IT CN IP Addressing 4
Example 5:
Consider a block of IP Addresses ranging from [Link] to [Link].
1. Is it a CIDR block?
2. If yes, give the CIDR representation
Solutions:
For any given block to be a CIDR block, 3 rules must be satisfied-
Rule-01:
 According to Rule-01, all the IP Addresses must be contiguous.
 Clearly, all the given IP Addresses are contiguous.
 So, Rule-01 is satisfied
Rule-02:
 According to Rule-02, size of the block must be presentable as 2n.
 Number of IP Addresses in the given block = 47 – 32 + 1 = 16.
 Size of the block = 16 which can be represented as 24.
 So, Rule-02 is satisfied.
Rule-03:
 According to Rule-03, first IP Address must be divisible by size of the block.
 So, [Link] must be divisible by 24.
 [Link] = 100.1.2.00100000 is divisible by 24 since its 4 least significant bits are zero.
 So, Rule-03 is satisfied.

Since all the rules are satisfied, therefore given block is a CIDR block.

CIDR Representation-
We have-
 Size of the block = Total number of IP Addresses = 2 4.
 To have 24 total number of IP Addresses, total 4 bits are required in the Host ID part.
 So, Number of bits present in the Network ID part = 32 – 4 = 28.
Thus,
CIDR Representation = [Link] / 28

SKK IT CN IP Addressing 5
Example 6:
Consider a block of IP Addresses ranging from [Link] to [Link].
1. Is it a CIDR block?
2. If yes, give the CIDR representation.
Solution-
For any given block to be a CIDR block, 3 rules must be satisfied-
Rule-01:
 According to Rule-01, all the IP Addresses must be contiguous.
 Clearly, all the given IP Addresses are contiguous.
 So, Rule-01 is satisfied.
Rule-02:
 According to Rule-02, size of the block must be presentable as 2n.
 Number of IP Addresses in given block = 127 – 64 + 1 = 64.
 Size of the block = 64 which can be represented as 26.
 So, Rule-02 is satisfied.
Rule-03:
 According to Rule-03, first IP Address must be divisible by size of the block.
 So, [Link] must be divisible by 26.
 [Link] = 150.10.20.01000000 is divisible by 26 since its 6 least significant bits are
zero.
So, Rule-03 is satisfied.
Since all the rules are satisfied, therefore given block is a CIDR block.
CIDR Representation-
We have-
 Size of the block = Total number of IP Addresses = 26.
 To have 26 total number of IP Addresses, 6 bits are required in the Host ID part.
 So, Number of bits in the Network ID part = 32 – 6 = 26.

Thus,
CIDR Representation = [Link] / 26

SKK IT CN IP Addressing 6
Example 7:
Perform CIDR aggregation on the following IP Addresses-
[Link]/24
[Link]/24
[Link]/24
[Link]/24
Solution-
All the 4 given entities represent CIDR block in itself.
We have to now perform the aggregation of these 4 blocks.
Rule-01:
 According to Rule-01, all the IP Addresses must be contiguous.
 Clearly, all the IP Addresses are contiguous.
 So, Rule-01 is satisfied.
Rule-02:
 According to Rule-02, size of the block must be presentable as 2n.
 Total number of IP Addresses = 28 + 28 + 28 + 28 = 22 x 28 = 210.
 So, Rule-02 is satisfied.
Rule-03:
 According to Rule-03, first IP Address must be divisible by size of the block.
 So, [Link] must be divisible by 210.
 [Link] = 128.56.00011000.00000000 is divisible by 210 since its 10 least significant
bits are zero.
 So, Rule-03 is satisfied.
 Since all the 3 rules are satisfied, so they can be aggregated.
CIDR Representation-
We have-
 Size of the block = Total number of IP Addresses = 2 10.
 To have 210 total number of IP Addresses, 10 bits are required in the Host ID part.
 So, Number of bits in the Network ID part = 32 – 10 = 22.
 Thus,
CIDR Representation = [Link]/22
SKK IT CN IP Addressing 7
Example 8:
Perform CIDR aggregation on the following IP Addresses-
[Link]/24
[Link]/24
[Link]/24
[Link]/24
Solution-
All the 4 given entities represent CIDR block in itself.
We have to now perform the aggregation of these 4 blocks.
Rule-01:
 According to Rule-01, all the IP Addresses must be contiguous.
 Clearly, all the IP Addresses are contiguous.
 So, Rule-01 is satisfied.
Rule-02:
 According to Rule-02, size of the block must be presentable as 2n.
 Total number of IP Addresses = 28 + 28 + 28 + 28 = 22 x 28 = 210.
 So, Rule-02 is satisfied.
Rule-03:
 According to Rule-03, first IP Address must be divisible by size of the block.
 So, [Link] must be divisible by 210.
 [Link] = 200.96.01010110.00000000 is not divisible by 210 since its 10 least
significant bits are not zero.
 So, Rule-03 is unsatisfied.

SKK IT CN IP Addressing 8

Common questions

Powered by AI

To verify if an IP block is a CIDR block, ensure it meets three criteria: all IP addresses must be contiguous; the block size must be representable as a power of two; and the first IP address must be divisible by the block size. For 150.10.20.64 to 150.10.20.127, all addresses are contiguous, there are 64 addresses (2^6), and the first IP (150.10.20.64) is divisible by 64, meeting all criteria .

To find the first address of a block given an IP like 205.16.37.39/28, you apply the network mask to the IP address by converting both to binary, then performing a bitwise AND operation. The network mask /28 corresponds to the binary 11111111 11111111 11111111 11110000. Performing bitwise AND with this mask sets the last four bits to zero, resulting in the first address 205.16.37.32. For the last address, you set the four least significant bits to 1, which results in 205.16.37.47 .

The CIDR notation is useful because it provides a more efficient use of IP address space than the traditional classful addressing. It allows for a flexible allocation that accommodates the number of hosts more closely, reducing waste. CIDR requires the IP addresses in the block to be contiguous, the size of the block to be a power of two, and the first IP address to be divisible by the size of the block .

When aggregating CIDR blocks, challenges include ensuring all blocks are contiguous, verifying that the aggregated block size is a power of two, and confirming divisibility by the block size. If any block doesn't meet these criteria, aggregation isn’t possible. For example, in CIDR aggregation, if the block doesn't divide equally or shows non-contiguous address patterns, it disrupts potential aggregation, as seen with non-divisible cases like 200.96.86.0/24 .

Calculating the number of hosts per subnet is crucial for ensuring the network can support the required number of devices. For a subnet mask like 255.255.255.224, converting the mask to binary gives 11111111 11111111 11111111 11100000. The number of zero bits (5) in the host portion indicates 2^5, meaning 32 addresses per subnet are available, providing adequate room for network devices .

Bitwise operations are fundamental in subnetting IP addresses because they allow precise control over setting bits. The network's boundary is determined using a bitwise AND between an IP address and a subnet mask, defining the network portion. Bitwise OR and complement operations help establish the broadcast address and range. For instance, setting the rightmost bits to zero gives the starting address of a subnet .

To determine the CIDR notation for the block 100.1.2.32 to 100.1.2.47, first confirm all addresses are contiguous and calculate the block size (16 addresses). Since 16 is 2^4, four bits are used for hosts. Subtracting from 32 bits leaves 28 bits for the network, yielding the CIDR representation 100.1.2.32/28 .

To design seven subnets, calculate the necessary bits to accommodate them: 2^3 = 8. Therefore, 3 additional bits for the network part are needed beyond the Class C default mask of /24, yielding a subnet mask of 255.255.255.224 (or /27). This provides 32 hosts per subnet, accommodating the organization’s requirements .

Classful IP addressing divides the IP space into fixed classes (A, B, C) with predetermined sizes, often leading to inefficient use of address space. In contrast, CIDR (Classless Inter-Domain Routing) allows for variable-length subnets that improve flexibility by allocating addresses more precisely as needed by network size, thereby reducing wasted addresses .

To validate the aggregation of IP ranges 128.56.24.0/24 to 128.56.27.0/24 into a CIDR block, confirm contiguity and calculate the total block size (1024 addresses). Check if the first address is divisible by the block size: 128.56.24.0 has its 10 least significant bits zero, reflecting divisibility. Therefore, the CIDR block is valid with representation 128.56.24.0/22 .

You might also like