0% found this document useful (0 votes)
21 views

Network Address and Mask

The document discusses network addresses and masks, explaining what they are and how they are used. It then provides examples of default masks for different IP address classes and how to find the network address given an IP address and mask. Subnetting and classless addressing are also explained at a high level.

Uploaded by

Shivansh Pathak
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Network Address and Mask

The document discusses network addresses and masks, explaining what they are and how they are used. It then provides examples of default masks for different IP address classes and how to find the network address given an IP address and mask. Subnetting and classless addressing are also explained at a high level.

Uploaded by

Shivansh Pathak
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Network Address and Mask

• Network address – It identifies a network on


internet.  Using this, we can find range of
addresses in the network and total possible
number of hosts in the network.
• Mask – It is a 32-bit binary number that gives
the network address in the address block
when AND operation is bitwise applied on the
mask and any IP address of the block.
• The default mask in different classes are :
• Class A – 255.0.0.0
• Class B – 255.255.0.0
• Class C – 255.255.255.0
• Example : Given IP address 132.6.17.85 and
default class B mask, find the beginning
address (network address).
• Solution : The default mask is 255.255.0.0,
which means that the only the first 2 bytes are
preserved and the other 2 bytes are set to 0.
Therefore, the network address is 132.6.0.0.
• Note-the IP address can be normal IP address or
it can be special IP address.
• Normal IP address- can be assign to any
computer.
• Special IP address- can not assign to any
computer.
• Network address(to create all host bits must be set to zero).
Ex-10.0.0.0
• Broad cast address (to create all host bits must be set to
one).Ex-10.255.255.255
IPv4 Datagram Header
• Size of the header is 20 to 60 bytes.
• VERSION: Version of the IP protocol (4 bits),
which is 4 for IPv4
• HLEN: IP header length (4 bits), which is the
number of 32 bit words in the header. The
minimum value for this field is 5
and the maximum is 15
• Type of service: Low Delay, High Throughput, Reliability (8 bits)
• Total Length: Length of header + Data (16 bits), which has a
minimum value 20 bytes and the maximum is 65,535 bytes
• Identification: Unique Packet Id for identifying the group of
fragments of a single IP datagram (16 bits)
• Flags: 3 flags of 1 bit each : reserved bit (must be zero),
do not fragment flag, more fragments flag (same order)
• Fragment Offset: Specified in terms of number of 8 bytes, which
has the maximum value of 65,528 bytes
• Time to live: Datagram’s lifetime (8 bits), It prevents the datagram
to loop through the network
• Protocol: Name of the protocol to which the data is to be passed
(8 bits)
• Header Checksum: 16 bits header checksum for checking errors in
the datagram header
• Source IP address: 32 bits IP address of the sender
• Destination IP address: 32 bits IP address of the receiver
• Option: Optional information such as source route, record route.
• Due to the presence of options, the size of the datagram header
can be of variable length (20 bytes to 60 bytes).
Subnetting
• Subnetting:  Dividing a large block of
addresses into several contiguous sub-blocks
and assigning these sub-blocks to different
smaller networks is called subnetting. It is a
practice that is widely used when classless
addressing is done.
Classless
•• Using
  a classful IP addressing format worked well when
the Internet was relatively small. But as the number of
networks on the Internet grew, the limitations of classful
addresses became apparent.
• The Class A address space contains only 125 usable
networks in the range 0–127 because networks 0 and 127
are reserved, and network 10 is used for private
addressing.
• Each of these 125 Class A networks could theoretically
contain – 2 or 16,777,214 hosts, but it's not realistic to
have more than 16 million hosts on the same network.
Classless cont.
• Therefore, in the early 1990s, the Internet
moved away from a classfull address space to
a classless address space. In other words, the
number of bits used for the network portion
of an IP address became variable instead of
fixed.
Classless cont.
• Classless Addressing is an improved IP
Addressing system.
• It makes the allocation of IP Addresses more
efficient.
• It replaces the older classful addressing
system based on classes.
• It is also known as Classless Inter Domain
Routing (CIDR).
CIDR Block
 

When a user asks for specific number of IP


Addresses,
• CIDR dynamically assigns a block of IP
Addresses based on certain rules.
• This block contains the required number of IP
Addresses as demanded by the user.
• This block of IP Addresses is called as a CIDR
block.
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 21, 22, 23, 24, 25 and so on.
• Rule-03:
– First IP Address of the block must be divisible by the size of the block.
• Remember
If any binary pattern consisting of (m + n) bits is
divided by 2n, then-
• Remainder is least significant n bits
• Quotient is most significant m bits
• So, any binary pattern is divisible by 2n, if and
only if its least significant n bits are 0. 
Examples
• Consider a binary pattern-
• 01100100.00000001.00000010.01000000
• (represented as 100.1.2.64)
• It is divisible by 25 since its least significant 5 bits
are zero.
• It is divisible by 26 since its least significant 6 bits
are zero.
• It is not divisible by 27 since its least significant 7
bits are not zero.
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.
Example
• An example of CIDR IP Address is-
182.0.1.2 / 28
It suggests-
 28 bits are used for the identification of
network.
 Remaining 4 bits are used for the
identification of hosts in the network.
PRACTICE PROBLEMS BASED ON CLASSLESS
INTER DOMAIN ROUTING
• Problem-01:
• Given the CIDR representation 20.10.30.35 /
27. Find the range of IP Addresses in the CIDR
block.
• Solution-
• Given CIDR representation is 20.10.30.35 / 27 
• It suggests-

• 27 bits are used for the identification of network.


• Remaining 5 bits are used for the identification of hosts in the network.

• Given CIDR IP Address may be represented as-


• 00010100.00001010.00011110.00100011 / 27

• So,
• First IP Address = 00010100.00001010.00011110.00100000 = 20.10.30.32
• Last IP Address = 00010100.00001010.00011110.00111111 = 20.10.30.63
• Thus, Range of IP Addresses = [ 20.10.30.32 , 20.10.30.63]
Problem-02:
• Given the CIDR representation 100.1.2.35 / 20. Find the range of IP Addresses in the CIDR block.
•  
• Solution-
 
• Given CIDR representation is 100.1.2.35 / 20.

• It suggests-
• 20 bits are used for the identification of network.
• Remaining 12 bits are used for the identification of hosts in the network.

• Given CIDR IP Address may be represented as-


• 01100100.00000001.00000010.00100011 / 20

• So,
• First IP Address = 01100100.00000001.00000000.00000000 = 100.1.0.0
• Last IP Address = 01100100.00000001.00001111.11111111 = 100.1.15.255

• Thus, Range of IP Addresses = [ 100.1.0.0 , 100.1.15.255]


Problem-03:
Consider a block of IP Addresses ranging from 100.1.2.32 to 100.1.2.47.
• Is it a CIDR block?
• 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 2 n.
• Number of IP Addresses in the given block = 47 – 32 + 1 = 16.
• Size of the block = 16 which can be represented as 2 4.
• So, Rule-02 is satisfied.

• Rule-03:

• According to Rule-03, first IP Address must be divisible by size of the block.


• So, 100.1.2.32 must be divisible by 2 4.
• 100.1.2.32 = 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 =
24.
• 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 = 100.1.2.32 / 28
DHA Problem-04:
• Consider a block of IP Addresses ranging from
150.10.20.64 to 150.10.20.127.
• Is it a CIDR block?
• If yes, give the CIDR representation.
Subnet mask
• 192.168.1.1/28. Here, subnet mask is found by
putting the given number of bits out of 32 as
1, like, in the given address, we need to put 28
out of 32 bits as 1 and the rest as 0, and so,
the subnet mask would be 255.255.255.240.
IPv6
• IP v6 was developed by Internet Engineering
Task Force (IETF) to deal with the problem of IP
v4 exhaustion. IP v6 is 128-bits address having
an address space of 2^128, which is way bigger
than IPv4. In IPv6 we use Colon-Hexa
representation. There are 8 groups and each
group represents 2 Bytes.

You might also like