IPV4 ADDRESSES
IPV4 ADDRESSES
• to identify the connection of each device to the Internet is called the
Internet address or IP address
• IPv4 address is a 32-bit address
• defines the connection of a host or a router to the Internet.
• The IP address is the address of the connection, not the host or the
router, because if the device is moved to another network, the IP
address may be changed.
• IPv4 addresses are unique in the sense that each address defines one,
and only one, connection to the Internet.
• If a device has two connections to the Internet, via two networks, it
has two IPv4 addresses.
• IPv4 addresses are universal in the sense that the addressing system
must be accepted by any host that wants to be connected to the
Internet.
IPV4 ADDRESSES
Address Space
• An address space is the total number of addresses used by the
protocol
• IPv4 uses 32-bit addresses, which means that the address space is 2b
or 4,294,967,296 (more than four billion).
• If there were no restrictions, more than 4 billion devices could be
connected to the Internet.
Notation
There are three common notations to show an IPv4 address:
• binary notation (base 2),
• dotted-decimal notation (base 256), and
• hexadecimal notation (base 16).
• In binary notation, an IPv4 address is displayed as 32 bits.
A 32-bit IPv4 address is also hierarchical, but divided only into two
parts.
• The first part of the address, called the prefix, defines the network;
• the second part of the address, called the suffix, defines the node
(connection of a device to the Internet).
Hierarchy in Addressing
Hierarchy in Addressing
• A prefix can be fixed length or variable length.
• The network identifier in the IPv4 was first designed as a fixed-length
prefix. This scheme, is referred to as classful addressing.
• The network identifier in the IPv4 uses a variable-length network
prefix. This scheme, which is referred to as classless addressing,
Classful Addressing
• IPv4 address was designed with a fixed-length prefix
• three fixed-length prefixes were designed instead of one (n = 8, n =
16, and n = 24)
• The whole address space was divided into five classes (class A, B, C, D,
and E)
• In class A, the network length is 8 bits, but since the first bit, which is 0,
defines the class, we can have only seven bits as the network identifier.
• This means there are only 27 = 128 networks in the world that can have a class
A address.
• class B, the network length is 16 bits, but since the first two bits, define the
class, we can have only 14 bits as the network identifier.
• This means there are only 214 = 16,384 networks in the world that can have a
class B address.
• first three bits 110 belong to class C. the network length is 24 bits, but since
three bits define the class, we can have only 21 bits as the network identifier.
This means there are 221 = 2,097,152
• 1110 bits to Class D is not divided into prefix and suffix. It is used for
multicast addresses.
• All addresses that start with 1111 in binary belong to class E. As in Class D,
Class E is not divided into prefix and suffix and is used as reserve.
• The 32 binary bits are broken into four octets (1 octet = 8 bits).
• Each octet is converted to decimal and separated by a period (dot).
For this reason,
• an IP address is said to be expressed in dotted decimal format (for
example, 172.16.81.100).
• The value in each octet ranges from 0 to 255 decimal, or 00000000 -
11111111 binary.
1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1
(128+64+32+16+8+4+2+1=255)
Class A Address
IP starting from 1.x.x.x to 126.x.x.x only
Class B Address
128.0.x.x to 191.255.x.x.
Class C Address
192.0.0.x to 223.255.255.x.
Class D Address
224.0.0.0 to 239.255.255.255.
Class E Address
240.0.0.0 to 255.255.255.254.
Q1
• What is the size of the address space in each of the following
systems?
• a. A system in which each address is only 16 bits
• b. A system in which each address is made of six hexadecimal digits
• c. A system in which each address is made of four octal digits
Ans:
• 216
• 166
• 84
Rewrite the following IP addresses
using binary notation:
• a. 110.11.5.88
• b. 12.74.16.18
• c. 201.24.44.32
ans
• a.110.11.5.88
01101110 00001011 00000101 01011000
• b.12.74.16.18
00001100 01001010 00010000 00010010
• c.201.24.44.32
11001001 00011000 00101100 00100000
Rewrite the following IP addresses
using dotted-decimal notation:
• a. 01011110 10110000 01110101 00010101
• b. 10001001 10001110 11010000 00110001
• c. 01010111 10000100 00110111 00001111
a.01011110 10110000 01110101 0001010
194 . 176 . 117 . 21
b.10001001 10001110 11010000 00110001
137 . 142 . 208 . 49
c.01010111 10000100 00110111 00001111
87 . 132 . 55 . 15
Find the class of the following classful IP addresses:
a.130.34.54.12
b.200.34.2.1
c.245.34.2.8
Find the class of the following classful IP addresses:
a.130.34.54.12
• Class B
b.200.34.2.1
• Class C
c.245.34.2.8
• Class D
Address Depletion
• The addresses were not distributed properly
• the Internet was faced with the problem of the addresses being
rapidly used up, resulting in no more addresses available for
organizations and Individuals that needed to be connected to the
Internet.
• Class A can be assigned to only 128 organizations in
the world, but each organization needs to have a
single network with 16,777,216 nodes (computers in
this single network). Since there may be only a few
organizations that are this large, most of the
addresses in this class were wasted (unused).
• Class B addresses were designed for midsize
organizations, but many of the addresses in this class
also remained unused.
• Class C addresses have a completely different flaw in
design. The number of addresses that can be used in
each network (256) was so small that most companies
were not comfortable using a block in this address
class.
• Class E addresses were almost never used, wasting
the whole class.
Advantage of Classful Addressing
• easily find the class of the address and, since the prefix length for
each class is fixed,
• the prefix length in classful addressing is inherent in the address;
• no extra information is needed to extract the prefix and the suffix
•To improve address depletion, two strategies
were proposed
•Subnetting and
•Supernetting
Subnetting and Supernetting
• The process of dividing a network into subnetwork is called as subnetting,
• The process of combining small networks into a large network is called
supernetting.
• In subnetting, the numbers of bits of network addresses are increased
• In supernetting the number of bits of host addresses is increased.
• Supernetting is designed to make the routing process more convenient.
• It reduces the size of routing table information; therefore, it consumes less
space in the router’s memory.
Subnetting
• single IP network : Problems with Large Networks
• Subnetting is the technique of partitioning a large network into
smaller networks
• Subnetting is a technique of partitioning an individual physical
network into several small-sized logical sub-networks. These
subnetworks are known as subnets.
• The Subnetting basically convert the host bits into the network bits
it can divide its network in four subnets.
same network
after Subnetting.
Without any Subnetting,
all computers will work
in a single large network.
Advantages-
• It improves the security.
• The maintenance and administration of subnets is easy.
Types of Subnetting
Fixed length subnetting also called as classful
subnetting divides the network into subnets where-
•All the subnets are of same size.
•All the subnets have equal number of hosts.
•All the subnets have same subnet mask.
Variable length subnetting also called as classless
subnetting divides the network into subnets where-
•All the subnets are not of same size.
•All the subnets do not have equal number of hosts.
•All the subnets do not have same subnet mask.
Step 1 : Identifying network portion and host portion in an IP address
- Subnetting can only be done in host portion.
- Subnet mask is used to distinguish the network portion from host
portion in an IP address.
Example-01:
• Consider-
• We have a big single network having IP Address 200.1.2.0.
• We want to do subnetting and divide this network into 2 subnets.
• For creating two subnets and to represent their subnet IDs, we require 1
bit.
• So, We borrow one bit from the Host ID part.
• After borrowing one bit, Host ID part remains with only 7 bits.
• If borrowed bit = 0, then it represents the first subnet.
• If borrowed bit = 1, then it represents the second subnet.
• IP Address of the two subnets are-
• 200.1.2.00000000 = 200.1.2.0
• 200.1.2.10000000 = 200.1.2.128
For 1st Subnet-
• IP Address of the subnet = 200.1.2.0
• Total number of IP Addresses = 27 = 128
• Total number of hosts that can be configured = 128 – 2(Reserved bits/special
address) = 126
• Range of IP Addresses =
[200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0, 200.1.2.127]
• Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
• Limited Broadcast Address = 255.255.255.255
For 2nd Subnet-
• IP Address of the subnet = 200.1.2.128
• Total number of IP Addresses = 27 = 128
• Total number of hosts that can be configured = 128 – 2 = 126
• Range of IP Addresses =
[200.1.2.10000000, 200.1.2.11111111] = [200.1.2.128, 200.1.2.255]
• Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
• Limited Broadcast Address = 255.255.255.255
Example-02:
• Consider-
• We have a big single network having IP Address 200.1.2.0.
• We want to do subnetting and divide this network into 4 subnets.
Answer
• Clearly, the given network belongs to class C.
• For creating four subnets and to represent their subnet IDs, we
require 2 bits.
• So,
• We borrow two bits from the Host ID part.
• After borrowing two bits, Host ID part remains with only 6 bits.
Answer (cont..)
• If borrowed bits = 00, then it represents the 1st subnet.
• If borrowed bits = 01, then it represents the 2nd subnet.
• If borrowed bits = 10, then it represents the 3rd subnet.
• If borrowed bits = 11, then it represents the 4th subnet.
• IP Address of the four subnets are-
• 200.1.2.00000000 = 200.1.2.0
• 200.1.2.01000000 = 200.1.2.64
• 200.1.2.10000000 = 200.1.2.128
• 200.1.2.11000000 = 200.1.2.192
For 1st Subnet-
• IP Address of the subnet = 200.1.2.0
• Total number of IP Addresses = 26 = 64
• Total number of hosts that can be configured = 64 – 2 = 62
• Range of IP Addresses = [200.1.2.00000000, 200.1.2.00111111] =
[200.1.2.0, 200.1.2.63]
• Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63
• Limited Broadcast Address = 255.255.255.255
For 2nd Subnet-
• IP Address of the subnet = 200.1.2.64
• Total number of IP Addresses = 26 = 64
• Total number of hosts that can be configured = 64 – 2 = 62
• Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] =
[200.1.2.64, 200.1.2.127]
• Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127
• Limited Broadcast Address = 255.255.255.255
For 3rd Subnet-
• IP Address of the subnet = 200.1.2.128
• Total number of IP Addresses = 26 = 64
• Total number of hosts that can be configured = 64 – 2 = 62
• Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] =
[200.1.2.128, 200.1.2.191]
• Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191
• Limited Broadcast Address = 255.255.255.255
For 4th Subnet-
• IP Address of the subnet = 200.1.2.192
• Total number of IP Addresses = 26 = 64
• Total number of hosts that can be configured = 64 – 2 = 62
• Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] =
[200.1.2.192, 200.1.2.255]
• Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255
• Limited Broadcast Address = 255.255.255.255
In decimal notation IP address : 192.168.10.10
Subnet mask : 255.255.255.0
In binary notation IP address : 11000000.10101000.00000001.00001010
Subnet mask : 11111111.11111111.11111111.00000000
On bits (1) represents network address bits(0) represents host address
Examples of IP address with subnet mask in decimal format
10.10.10.10
255.0.0.0
172.168.1.1
255.255.0.0
192.168.1.1
255.255.255.0
Examples of IP address with subnet mask in binary
format
00001010.00001010.00001010.00001010
11111111.00000000.00000000.00000000
10101100.10101000.00000001.00000001
11111111.11111111.00000000.00000000
11000000.10101000.00000001.00000001
11111111.11111111.11111111.00000000
Reserved network bits and host bits cannot be used in Subnetting.
IP
Class
First IP Address
of class
Last IP Address of
class
Default
Subnet Mask
Default
Network bits
Host bits Reserved host
bits
A 0.0.0.0 127.255.255.255 255.0.0.0 First 8 bits 9 to 30 31, 32
B 128.0.0.0 191.255.255.255 255.255.0.0 First 16 bits 17 to 30 31, 32
C 192.0.0.0 223.255.255.255 255.255.255.0 First 24 bits 25 to 30 31, 32
Subnetting
For example
• if a network in class A is divided into four subnets, each
subnet has a prefix of nsub = 10.
• At the same time, if all of the addresses in a network are
not used,
• subnetting allows the addresses to be divided among
several organizations.
• to divide a large block into smaller ones
Subnetting
• The network is first reached using the netid, and then the specific
host is reached using the hostid.
• This addressing scheme approaches all networks as if they are just
one large network with several hosts
need of subnetting
• Hosts on the network could not be organized into groups.
• With this scheme, you could not create separate networks for
departments within an organization.
• All networks would be at the same level. If all hosts were connected
to the same physical network
• bandwidth would be quickly consumed during peak usage hours.
• All users would be sending and receiving over the same cable.
In this example, all our hosts are connected to the same
physical network.
dividing a large Class B network into three
smaller subnetworks.
• The router now knows that the original 142.15.3.0 network has been
subnetted into two smaller subnetworks.
The router interprets IP address information in the following manner:
• The first two bits, or octets, 143.15, are used to define the netid
(143.15.0.0 or 143.15.4.0).
• The third octet is used to define the subnetid (143.15.4.0 or
143.15.5.0).
• The last octet is used to define the hostid—for example, 143.15.5.31.
• Netid—Defines the entire site within the organization
• Subnetid—Defines the physical subnetwork
• Hostid—Identifies each host connected to the subnetwork
when IP information is sent to the network from the Internet, three
steps are involved in routing the information:
• The IP packet is delivered to the site (143.15.0.0).
• The packet is forwarded to the correct subnetwork (143.15.4.0 or
143.15.5.0).
• The packet is delivered to the correct host.
Class B network with and without subnetting:
Class B network without subnetting
Netid Hostid
143.15 .3.20
Class B network with subnetting
Netid Subnetid Hostid
143.15 .3 .20
Subnet masking
• Subnet masking is a process used to extract the physical network
address from an IP address.
• masking may be done whether there is a subnet in place or not.
• If there is no subnet, masking extracts the network address.
• If there is a subnet, masking extracts the subnetwork address.
How subnet mask is created
• For example, let’s assume we want to determine the netmask for the
192.168.1.0 network.
• In binary format, 192.168.1.0 is written as:
11000000.10101000.00000001.00000000
11000000.10101000.00000001.00000000
• The three leftmost bits are 110, so we know that this is a Class C
address.
• This means that the first 24 bits are used for the netid and the last 8
bits are used for the hostid.
• To determine the netmask, set all the network bits to 1 and all the
host bits to zero.
• In binary format, this is:
11111111.11111111.11111111.00000000
• Converted to decimal format, this gives us a netmask of
255.255.255.0.
Example
• A network has 10.0.0.0 for the netid.
• In binary format, this address translates to:
00001010.00000000.00000000.00000000
Solution:
• When we set all the network bits to 1 and all the host
bits to 0, we get:
11111111.00000000.00000000.00000000
• Decimal part : 255.0.0.0
Type of subnetting : VLSM & FLSM
• VLSM (Variable Length Subnet Mask) is a technique
which partitions IP address space into subnets of
different sizes and prevent memory wastage.
• when the number of hosts is same in subnets, that is
known as FLSM (Fixed Length Subnet Mask).
• Supernetting was devised to make the routing process more
convenient.
• Additionally, it reduces the size of routing table information so that it
could consume less space in the router’s memory.
• to combine several class C blocks into a larger block to be attractive
to organizations that need more than the 256 addresses available in a
class C block
Supernetting
Network address and Broadcast address
• In each network there are two special addresses;
• network address and broadcast address.
• Network address represents the network itself while broadcast
address represents all the hosts which belong to it. These two
addresses can’t be assigned to any individual host in network. Since
each subnet represents an individual network, it also uses these
two addresses.
(N-2)
Subnetting
• network bits are converted into host bits.
• Subnetting process is performed to slow down the depletion of the IP
addresses.
• It allows the administrator to divide the single class A, class B and class C
into small segments.
• VLSM (Variable Length Subnet Mask) and
• FLSM (Fixed Length Subnet Mask).
• The process of partitioning the IP address space into a subnet of different
size is called a Variable Length Subnet Mask.
• VLSM reduces the wastage of memory.
• The process of partitioning the IP address space into a subnet of the same
size is called a Fixed Length Subnet Mask.
Classless Addressing
(Supernetting)
CIDR (Classless Inter-Domain Routing)
• It is a supernetting technique where the several subnets are
combined together for the network routing.
• It is scheme used to route the network traffic across the internet.
Supernetting
• supernetting is the method used for combining the
smaller ranges of addresses into larger space.
• several networks are merged into a single network
Classless
Addressing
Classless Addressing
• To reduce the wastage of IP addresses in a block, we use Classless Addressing
• the classless addressing assigns a block of addresses to the customer according
to its requirement which prevents the wastage of addresses.
• variable-length blocks are used that belong to no classes.
• This block contains the required number of IP Addresses as demanded by the
user.
• The classless IPv4 addressing does not divide the address space into classes like
classful addressing. It provides a variable-length of blocks, which have a range
of addresses according to the need of users.
• This block of IP Addresses is called as a Classless Inter Domain Routing (CIDR)
block.
• The 32 binary bits are broken into four octets (1 octet = 8 bits).
• Each octet is converted to decimal and separated by a period (dot).
• The value in each octet ranges from 0 to 255 decimal, or
00000000 to11111111 binary.
1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)
Here is a sample octet conversion when not all of the bits are set to 1.
0 1 0 0 0 0 0 1
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)
And this sample shows an IP address represented in both binary and
decimal.
Class A network(net ID),node (Host ID),node,node
Class B network,network,node,node
Class C network,network,network,node
In a Class A address : network address of 0.0.0.0 – 255.0.0.0
In a Class B address : network address of 0.0.0.0 – 255.255.0.0
In a Class C address : network address of 0.0.0.0 – 255.255.255.0
Variable-Length Blocks
• The whole address space (2^32 addresses) is divided into blocks of
different sizes
• In classless addressing, the whole address space is divided into
variable length blocks.
• Addresses have two parts:
• subnet or prefix, The prefix in an address defines the block (network);
• Host - defines the node (device).
• The prefix in an address defines the block (network);
• the suffix defines the node (device).
• Define a block of 2 addresses, is that the number of addresses in a
block needs to be a power of 2.
Classless Addressing
Network part (All 1s) Host part (All 0s)
Total no.of host connected in this network = 2 no.of zeros
=216 - 2
(Here 2 is reserved IP and Network IP)
=2¹⁴ = 2×2×2×2×2×2×2×2×2×2×2×2×2×2 = 16384
Network mask (only calculate all 1s) = 255.255.0.0
Prefix Length: Slash Notation (/)
172.31.0.0/18
(16th next value : To take next value to set subnetwork start)
Last bit value add to previous : 32+32
64+32
96+32
128+32
168+32
192+32
224+32 ( 256 – not valid so stop the process )
Extracting Information from an Address
• Given any address in the block, to know three pieces of information
about the block to which the address belongs:
1. the number of addresses,
2. the first address in the block, and
3. the last address.
Since the value of prefix length, n, is given, we can
• easily find these three pieces of information,
Type 1 Technique:
Extracting Information from an Address
• three pieces of information about the block to which the address belongs:
1. the number of addresses - The number of addresses in the block is found as
N = 232−n
2. the first address in the block - To find the first address, we keep the n
leftmost bits and set the (32 − n) rightmost bits all to 0s.
3. the last address - To find the last address, we keep the n leftmost bits and
set the (32 − n) rightmost bits all to 1s.
Example
• A classless address is given as 167.199.170.82/27. We can find the above
three pieces of information as follows.
1. The number of addresses in the network is 232 − n = 232 − 27 = 25 = 32
addresses.
2. Convert 167.199.170.82 into binary values
10100111 11000111 10101010 01010010
To fine First address: 167.199.170.64/27
10100111 11000111 10101010 01000000
3. The last address can be found by keeping the first 27 bits and changing the
rest of the bits to 1s.
Address: 167.199.170.82/27 10100111 11000111 10101010 01011111
Last address: 167.199.170.95/27 10100111 11000111 10101010 01011111
Type 2 : Address Mask
• Another way to find the first and last addresses in the block is to use
the address mask.
• The address mask is a 32-bit number in which the n leftmost bits are
set to 1s and the rest of the bits (32 - n) are set to 0s.
• A computer can easily find the address mask because it is the
complement of (2(32 - n) - 1).
Address Mask
• Another way to find the first and last addresses in the block is to use the
address mask.
• find the address mask because it is the complement of (232 − n − 1).
• 1. The number of addresses in the block N = NOT (mask) + 1.
• 2. The first address in the block = (Any address in the block) AND (mask).
• 3. The last address in the block = (Any address in the block) OR [(NOT (mask)].
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
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
Address Mask
• The reason for defining a mask in this way is that it can be
used by a computer program to extract the information in
a block, using the three bit-wise operations NOT, AND,
and OR.
1. The number of addresses in the block N = NOT (mask) +
1.
2. The first address in the block = (Any address in the
block) AND (mask).
3. The last address in the block = (Any address in the
block) OR [(NOT (mask)].
Address Mask
• A classless address is given as 167.199.170.82/27.
• We can find the above three pieces of information
using the mask.
• The mask in dotted-decimal notation is
256.256.256.224.
• The AND, OR, and NOT operations can be applied to
individual bytes
• Number of addresses in the block: N = NOT (mask) + 1
= 00000000 00000000 00000000 00011111
= 0.0.0.31 + 1 = 32 addresses
First address:167.199.170.64
First = (address) AND (mask)
10100111 11000111 10101010 01010010
11111111 11111111 11111111 11100000
--------------------------------------------------------
10100111 11000111 10101010 01000000
---------------------------------------------------------
Last address: 167.199.170.95
Last = (address) OR (NOT mask) = 167.199.170.255
10100111 11000111 10101010 01010010
00000000 00000000 00000000 00011111
--------------------------------------------------------
10100111 11000111 10101010 01011111
--------------------------------------------------------
Block Allocation
Block Allocation
Example : Block Allocation
• An organization is granted a block of addresses with the beginning
address 14.24.74.0/24. The organization needs to have 3 subblocks of
addresses to use in its three subnets: one subblock of 10 addresses,
one subblock of 60 addresses, and one subblock of 120 addresses.
Design the subblocks.
Solution
• There are 2 32 – 24 = 256 addresses in this block.
• The first address is 14.24.74.0/24;
• the last address is 14.24.74.255/24.
• To satisfy the third requirement, we assign addresses to subblocks,
starting with the largest and ending with the smallest one.
• The number of addresses in the largest subblock, which requires 120
addresses, is not a power of 2. We allocate 128 addresses.
• The subnet mask for this subnet can be found as n1 = 32 - log2128 =
25.
• The first address in this block is 14.24.74.0/25; the last address is
14.24.74.127/25
• The number of addresses in the second largest subblock,
which requires 60 addresses, is not a power of 2 either.
• We allocate 64 addresses. The subnet mask for this
subnet can be found as n2 = 32 - log264 = 26.
• The first address in this block is 14.24.74.128/26;
• the last address is 14.24.74.191/26
• The number of addresses in the smallest subblock, which
requires 10 addresses, is not a power of 2 either. We
allocate 16 addresses. The subnet mask for this subnet
can be found as
• n3 = 32 - log216 = 28.
• The first address in this block is 14.24.74.192/28;
• the last address is 14.24.74.207/28.
If we add all addresses in the previous subblocks, the result
is 208 addresses,
• Which means 48 addresses are left in reserve. The first
address in this range is 14.24.74.208.
• The last address is 14.24.74.255.
Special Addresses
• This-host Address : 0.0.0.0/32 is called the this-host address(It is
used whenever
• a host needs to send an IP datagram but it does not know its own
address to use as the source address.
Limited-broadcast Address
• The only address in the block 255.255.255.255/32 is called the
limited-broadcast address.
• It is used whenever a router or a host needs to send a datagram to all
devices in a network.
• The routers in the network, however, block the packet having this
address as the destination;
• the packet cannot travel outside the network.
Loopback Address
• The block 127.0.0.0/8 is called the loopback address.
• A packet with one of the addresses in this block as the
destination address never leaves the host; it will remain
in the host. Any address in the block is used to test a
piece of software in the machine.
For
• example, we can write a client and a server program in
which one of the addresses in the block is used as the
server address.
• We can test the programs using the same host to see if
they work before running them on different computers
Private Addresses
• Four blocks are assigned as private addresses:
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and
169.254.0.0/16.
Multicast Addresses
• The block 224.0.0.0/4 is reserved for multicast addresses.
Comparison
Basis for comparison Subnetting Supernetting
Basic
A process of dividing a network
into subnetworks.
A process of combining
small networks into a larger
network.
Procedure
The number of bits of network
addresses is increased.
The number of bits of host
addresses is increased.
Mask bits are moved
towards
Right of the default mask. Left of the default mask.
Implementation
VLSM (Variable-length subnet
masking).
CIDR (Classless
interdomain routing).
Purpose
Used to reduce the address
depletion.
To simplify and fasten the
routing process
Consider the following subnet masks-
• 255.0.0.0
• 255.128.0.0
• 255.192.0.0
• 255.240.0.0
• 255.255.0.0
• 255.255.254.0
• 255.255.255.0
• 255.255.255.224
• 225.255.255.240
For each subnet mask, find-
1. Number of hosts per subnet
2. Number of subnets if subnet mask belongs to class A
3. Number of subnets if subnet mask belongs to class B
4. Number of subnets if subnet mask belongs to class C
5. Number of subnets if total 10 bits are used for the
global network ID
Given subnet mask is 255.0.0.0
Q1:
• Number of Net ID bits + Number of Subnet ID bits = 8
• Number of Host ID bits = 24
Q2:
• Since number of Host ID bits = 24,
• So Number of hosts per subnet = 224 – 2
Q3:
• If the given subnet mask belongs to class A, then
number of Net ID bits = 8.
• Substituting in the above equation, we get-
• Number of Subnet ID bits = 8 – 8 = 0
• Thus, there will be only one single network
Q4:
• First two octets of the subnet mask are not
completely filled with 1’s.
• So, given subnet mask can not belong to class B.
Q5:
• First three octets of the subnet mask are not
completely filled with 1’s.
• So, given subnet mask can not belong to class C.
Q6:
• First 10 bits of the subnet mask are not completely
filled with 1’s.
• So, given subnet mask can not use 10 bits for the
Network ID.
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.
Subnet Mask
Convert into subnet mask
• 11111111 11111111 11111111 00000000
Convert into subnet mask
• 11111111 11111111 11111111 00000000
• 255.255.255.0
Method 1 : Example
• A classless address is given as 167.199.170.82/27.
• We can find the above three pieces of information as
follows.
1. The number of addresses in the network is 232 - n
• = 25 = 32 addresses.
2. To find the first address
• The first address can be found by keeping the first 27 bits
and changing the rest of the bits to 0s.
• Address: 167.199.170.82/27
• 10100111 11000111 10101010 01010010
• First address: 167.199.170.64/27
• 10100111 11000111 10101010 01000000
3.The last address
• The last address can be found by keeping the first 27
bits and changing the rest of the bits to 1s.
• Address: 167.199.170.82/27
• 10100111 11000111 10101010 01011111
• Last address: 167.199.170.95/27
• 10100111 11000111 10101010 01011111

IPV4 addresses

  • 1.
  • 2.
    IPV4 ADDRESSES • toidentify the connection of each device to the Internet is called the Internet address or IP address • IPv4 address is a 32-bit address • defines the connection of a host or a router to the Internet. • The IP address is the address of the connection, not the host or the router, because if the device is moved to another network, the IP address may be changed.
  • 4.
    • IPv4 addressesare unique in the sense that each address defines one, and only one, connection to the Internet. • If a device has two connections to the Internet, via two networks, it has two IPv4 addresses. • IPv4 addresses are universal in the sense that the addressing system must be accepted by any host that wants to be connected to the Internet. IPV4 ADDRESSES
  • 5.
    Address Space • Anaddress space is the total number of addresses used by the protocol • IPv4 uses 32-bit addresses, which means that the address space is 2b or 4,294,967,296 (more than four billion). • If there were no restrictions, more than 4 billion devices could be connected to the Internet.
  • 6.
    Notation There are threecommon notations to show an IPv4 address: • binary notation (base 2), • dotted-decimal notation (base 256), and • hexadecimal notation (base 16). • In binary notation, an IPv4 address is displayed as 32 bits.
  • 8.
    A 32-bit IPv4address is also hierarchical, but divided only into two parts. • The first part of the address, called the prefix, defines the network; • the second part of the address, called the suffix, defines the node (connection of a device to the Internet). Hierarchy in Addressing
  • 10.
    Hierarchy in Addressing •A prefix can be fixed length or variable length. • The network identifier in the IPv4 was first designed as a fixed-length prefix. This scheme, is referred to as classful addressing. • The network identifier in the IPv4 uses a variable-length network prefix. This scheme, which is referred to as classless addressing,
  • 11.
    Classful Addressing • IPv4address was designed with a fixed-length prefix • three fixed-length prefixes were designed instead of one (n = 8, n = 16, and n = 24) • The whole address space was divided into five classes (class A, B, C, D, and E)
  • 12.
    • In classA, the network length is 8 bits, but since the first bit, which is 0, defines the class, we can have only seven bits as the network identifier. • This means there are only 27 = 128 networks in the world that can have a class A address. • class B, the network length is 16 bits, but since the first two bits, define the class, we can have only 14 bits as the network identifier. • This means there are only 214 = 16,384 networks in the world that can have a class B address. • first three bits 110 belong to class C. the network length is 24 bits, but since three bits define the class, we can have only 21 bits as the network identifier. This means there are 221 = 2,097,152 • 1110 bits to Class D is not divided into prefix and suffix. It is used for multicast addresses. • All addresses that start with 1111 in binary belong to class E. As in Class D, Class E is not divided into prefix and suffix and is used as reserve.
  • 14.
    • The 32binary bits are broken into four octets (1 octet = 8 bits). • Each octet is converted to decimal and separated by a period (dot). For this reason, • an IP address is said to be expressed in dotted decimal format (for example, 172.16.81.100). • The value in each octet ranges from 0 to 255 decimal, or 00000000 - 11111111 binary. 1 1 1 1 1 1 1 1 128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)
  • 16.
    Class A Address IPstarting from 1.x.x.x to 126.x.x.x only Class B Address 128.0.x.x to 191.255.x.x. Class C Address 192.0.0.x to 223.255.255.x. Class D Address 224.0.0.0 to 239.255.255.255. Class E Address 240.0.0.0 to 255.255.255.254.
  • 17.
    Q1 • What isthe size of the address space in each of the following systems? • a. A system in which each address is only 16 bits • b. A system in which each address is made of six hexadecimal digits • c. A system in which each address is made of four octal digits
  • 18.
  • 19.
    Rewrite the followingIP addresses using binary notation: • a. 110.11.5.88 • b. 12.74.16.18 • c. 201.24.44.32
  • 20.
    ans • a.110.11.5.88 01101110 0000101100000101 01011000 • b.12.74.16.18 00001100 01001010 00010000 00010010 • c.201.24.44.32 11001001 00011000 00101100 00100000
  • 21.
    Rewrite the followingIP addresses using dotted-decimal notation: • a. 01011110 10110000 01110101 00010101 • b. 10001001 10001110 11010000 00110001 • c. 01010111 10000100 00110111 00001111
  • 22.
    a.01011110 10110000 011101010001010 194 . 176 . 117 . 21 b.10001001 10001110 11010000 00110001 137 . 142 . 208 . 49 c.01010111 10000100 00110111 00001111 87 . 132 . 55 . 15
  • 23.
    Find the classof the following classful IP addresses: a.130.34.54.12 b.200.34.2.1 c.245.34.2.8
  • 24.
    Find the classof the following classful IP addresses: a.130.34.54.12 • Class B b.200.34.2.1 • Class C c.245.34.2.8 • Class D
  • 25.
    Address Depletion • Theaddresses were not distributed properly • the Internet was faced with the problem of the addresses being rapidly used up, resulting in no more addresses available for organizations and Individuals that needed to be connected to the Internet.
  • 26.
    • Class Acan be assigned to only 128 organizations in the world, but each organization needs to have a single network with 16,777,216 nodes (computers in this single network). Since there may be only a few organizations that are this large, most of the addresses in this class were wasted (unused). • Class B addresses were designed for midsize organizations, but many of the addresses in this class also remained unused. • Class C addresses have a completely different flaw in design. The number of addresses that can be used in each network (256) was so small that most companies were not comfortable using a block in this address class. • Class E addresses were almost never used, wasting the whole class.
  • 27.
    Advantage of ClassfulAddressing • easily find the class of the address and, since the prefix length for each class is fixed, • the prefix length in classful addressing is inherent in the address; • no extra information is needed to extract the prefix and the suffix
  • 28.
    •To improve addressdepletion, two strategies were proposed •Subnetting and •Supernetting
  • 29.
    Subnetting and Supernetting •The process of dividing a network into subnetwork is called as subnetting, • The process of combining small networks into a large network is called supernetting. • In subnetting, the numbers of bits of network addresses are increased • In supernetting the number of bits of host addresses is increased. • Supernetting is designed to make the routing process more convenient. • It reduces the size of routing table information; therefore, it consumes less space in the router’s memory.
  • 30.
    Subnetting • single IPnetwork : Problems with Large Networks • Subnetting is the technique of partitioning a large network into smaller networks • Subnetting is a technique of partitioning an individual physical network into several small-sized logical sub-networks. These subnetworks are known as subnets. • The Subnetting basically convert the host bits into the network bits
  • 31.
    it can divideits network in four subnets. same network after Subnetting. Without any Subnetting, all computers will work in a single large network.
  • 32.
    Advantages- • It improvesthe security. • The maintenance and administration of subnets is easy.
  • 33.
    Types of Subnetting Fixedlength subnetting also called as classful subnetting divides the network into subnets where- •All the subnets are of same size. •All the subnets have equal number of hosts. •All the subnets have same subnet mask. Variable length subnetting also called as classless subnetting divides the network into subnets where- •All the subnets are not of same size. •All the subnets do not have equal number of hosts. •All the subnets do not have same subnet mask.
  • 34.
    Step 1 :Identifying network portion and host portion in an IP address - Subnetting can only be done in host portion. - Subnet mask is used to distinguish the network portion from host portion in an IP address.
  • 35.
    Example-01: • Consider- • Wehave a big single network having IP Address 200.1.2.0. • We want to do subnetting and divide this network into 2 subnets.
  • 36.
    • For creatingtwo subnets and to represent their subnet IDs, we require 1 bit. • So, We borrow one bit from the Host ID part. • After borrowing one bit, Host ID part remains with only 7 bits. • If borrowed bit = 0, then it represents the first subnet. • If borrowed bit = 1, then it represents the second subnet. • IP Address of the two subnets are- • 200.1.2.00000000 = 200.1.2.0 • 200.1.2.10000000 = 200.1.2.128
  • 37.
    For 1st Subnet- •IP Address of the subnet = 200.1.2.0 • Total number of IP Addresses = 27 = 128 • Total number of hosts that can be configured = 128 – 2(Reserved bits/special address) = 126 • Range of IP Addresses = [200.1.2.00000000, 200.1.2.01111111] = [200.1.2.0, 200.1.2.127] • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127 • Limited Broadcast Address = 255.255.255.255
  • 38.
    For 2nd Subnet- •IP Address of the subnet = 200.1.2.128 • Total number of IP Addresses = 27 = 128 • Total number of hosts that can be configured = 128 – 2 = 126 • Range of IP Addresses = [200.1.2.10000000, 200.1.2.11111111] = [200.1.2.128, 200.1.2.255] • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255 • Limited Broadcast Address = 255.255.255.255
  • 39.
    Example-02: • Consider- • Wehave a big single network having IP Address 200.1.2.0. • We want to do subnetting and divide this network into 4 subnets.
  • 40.
    Answer • Clearly, thegiven network belongs to class C. • For creating four subnets and to represent their subnet IDs, we require 2 bits. • So, • We borrow two bits from the Host ID part. • After borrowing two bits, Host ID part remains with only 6 bits.
  • 41.
    Answer (cont..) • Ifborrowed bits = 00, then it represents the 1st subnet. • If borrowed bits = 01, then it represents the 2nd subnet. • If borrowed bits = 10, then it represents the 3rd subnet. • If borrowed bits = 11, then it represents the 4th subnet. • IP Address of the four subnets are- • 200.1.2.00000000 = 200.1.2.0 • 200.1.2.01000000 = 200.1.2.64 • 200.1.2.10000000 = 200.1.2.128 • 200.1.2.11000000 = 200.1.2.192
  • 42.
    For 1st Subnet- •IP Address of the subnet = 200.1.2.0 • Total number of IP Addresses = 26 = 64 • Total number of hosts that can be configured = 64 – 2 = 62 • Range of IP Addresses = [200.1.2.00000000, 200.1.2.00111111] = [200.1.2.0, 200.1.2.63] • Direct Broadcast Address = 200.1.2.00111111 = 200.1.2.63 • Limited Broadcast Address = 255.255.255.255
  • 43.
    For 2nd Subnet- •IP Address of the subnet = 200.1.2.64 • Total number of IP Addresses = 26 = 64 • Total number of hosts that can be configured = 64 – 2 = 62 • Range of IP Addresses = [200.1.2.01000000, 200.1.2.01111111] = [200.1.2.64, 200.1.2.127] • Direct Broadcast Address = 200.1.2.01111111 = 200.1.2.127 • Limited Broadcast Address = 255.255.255.255
  • 44.
    For 3rd Subnet- •IP Address of the subnet = 200.1.2.128 • Total number of IP Addresses = 26 = 64 • Total number of hosts that can be configured = 64 – 2 = 62 • Range of IP Addresses = [200.1.2.10000000, 200.1.2.10111111] = [200.1.2.128, 200.1.2.191] • Direct Broadcast Address = 200.1.2.10111111 = 200.1.2.191 • Limited Broadcast Address = 255.255.255.255
  • 45.
    For 4th Subnet- •IP Address of the subnet = 200.1.2.192 • Total number of IP Addresses = 26 = 64 • Total number of hosts that can be configured = 64 – 2 = 62 • Range of IP Addresses = [200.1.2.11000000, 200.1.2.11111111] = [200.1.2.192, 200.1.2.255] • Direct Broadcast Address = 200.1.2.11111111 = 200.1.2.255 • Limited Broadcast Address = 255.255.255.255
  • 46.
    In decimal notationIP address : 192.168.10.10 Subnet mask : 255.255.255.0 In binary notation IP address : 11000000.10101000.00000001.00001010 Subnet mask : 11111111.11111111.11111111.00000000 On bits (1) represents network address bits(0) represents host address
  • 47.
    Examples of IPaddress with subnet mask in decimal format 10.10.10.10 255.0.0.0 172.168.1.1 255.255.0.0 192.168.1.1 255.255.255.0
  • 48.
    Examples of IPaddress with subnet mask in binary format 00001010.00001010.00001010.00001010 11111111.00000000.00000000.00000000 10101100.10101000.00000001.00000001 11111111.11111111.00000000.00000000 11000000.10101000.00000001.00000001 11111111.11111111.11111111.00000000
  • 49.
    Reserved network bitsand host bits cannot be used in Subnetting. IP Class First IP Address of class Last IP Address of class Default Subnet Mask Default Network bits Host bits Reserved host bits A 0.0.0.0 127.255.255.255 255.0.0.0 First 8 bits 9 to 30 31, 32 B 128.0.0.0 191.255.255.255 255.255.0.0 First 16 bits 17 to 30 31, 32 C 192.0.0.0 223.255.255.255 255.255.255.0 First 24 bits 25 to 30 31, 32
  • 50.
    Subnetting For example • ifa network in class A is divided into four subnets, each subnet has a prefix of nsub = 10. • At the same time, if all of the addresses in a network are not used, • subnetting allows the addresses to be divided among several organizations. • to divide a large block into smaller ones
  • 51.
    Subnetting • The networkis first reached using the netid, and then the specific host is reached using the hostid. • This addressing scheme approaches all networks as if they are just one large network with several hosts
  • 52.
    need of subnetting •Hosts on the network could not be organized into groups. • With this scheme, you could not create separate networks for departments within an organization. • All networks would be at the same level. If all hosts were connected to the same physical network • bandwidth would be quickly consumed during peak usage hours. • All users would be sending and receiving over the same cable.
  • 53.
    In this example,all our hosts are connected to the same physical network.
  • 54.
    dividing a largeClass B network into three smaller subnetworks.
  • 56.
    • The routernow knows that the original 142.15.3.0 network has been subnetted into two smaller subnetworks. The router interprets IP address information in the following manner: • The first two bits, or octets, 143.15, are used to define the netid (143.15.0.0 or 143.15.4.0). • The third octet is used to define the subnetid (143.15.4.0 or 143.15.5.0). • The last octet is used to define the hostid—for example, 143.15.5.31.
  • 57.
    • Netid—Defines theentire site within the organization • Subnetid—Defines the physical subnetwork • Hostid—Identifies each host connected to the subnetwork when IP information is sent to the network from the Internet, three steps are involved in routing the information: • The IP packet is delivered to the site (143.15.0.0). • The packet is forwarded to the correct subnetwork (143.15.4.0 or 143.15.5.0). • The packet is delivered to the correct host.
  • 58.
    Class B networkwith and without subnetting: Class B network without subnetting Netid Hostid 143.15 .3.20 Class B network with subnetting Netid Subnetid Hostid 143.15 .3 .20
  • 59.
    Subnet masking • Subnetmasking is a process used to extract the physical network address from an IP address. • masking may be done whether there is a subnet in place or not. • If there is no subnet, masking extracts the network address. • If there is a subnet, masking extracts the subnetwork address.
  • 60.
    How subnet maskis created • For example, let’s assume we want to determine the netmask for the 192.168.1.0 network. • In binary format, 192.168.1.0 is written as: 11000000.10101000.00000001.00000000
  • 61.
    11000000.10101000.00000001.00000000 • The threeleftmost bits are 110, so we know that this is a Class C address. • This means that the first 24 bits are used for the netid and the last 8 bits are used for the hostid. • To determine the netmask, set all the network bits to 1 and all the host bits to zero. • In binary format, this is: 11111111.11111111.11111111.00000000 • Converted to decimal format, this gives us a netmask of 255.255.255.0.
  • 62.
    Example • A networkhas 10.0.0.0 for the netid. • In binary format, this address translates to: 00001010.00000000.00000000.00000000 Solution: • When we set all the network bits to 1 and all the host bits to 0, we get: 11111111.00000000.00000000.00000000 • Decimal part : 255.0.0.0
  • 67.
    Type of subnetting: VLSM & FLSM • VLSM (Variable Length Subnet Mask) is a technique which partitions IP address space into subnets of different sizes and prevent memory wastage. • when the number of hosts is same in subnets, that is known as FLSM (Fixed Length Subnet Mask).
  • 68.
    • Supernetting wasdevised to make the routing process more convenient. • Additionally, it reduces the size of routing table information so that it could consume less space in the router’s memory. • to combine several class C blocks into a larger block to be attractive to organizations that need more than the 256 addresses available in a class C block Supernetting
  • 69.
    Network address andBroadcast address • In each network there are two special addresses; • network address and broadcast address. • Network address represents the network itself while broadcast address represents all the hosts which belong to it. These two addresses can’t be assigned to any individual host in network. Since each subnet represents an individual network, it also uses these two addresses. (N-2)
  • 70.
    Subnetting • network bitsare converted into host bits. • Subnetting process is performed to slow down the depletion of the IP addresses. • It allows the administrator to divide the single class A, class B and class C into small segments. • VLSM (Variable Length Subnet Mask) and • FLSM (Fixed Length Subnet Mask). • The process of partitioning the IP address space into a subnet of different size is called a Variable Length Subnet Mask. • VLSM reduces the wastage of memory. • The process of partitioning the IP address space into a subnet of the same size is called a Fixed Length Subnet Mask.
  • 71.
  • 72.
    CIDR (Classless Inter-DomainRouting) • It is a supernetting technique where the several subnets are combined together for the network routing. • It is scheme used to route the network traffic across the internet.
  • 73.
    Supernetting • supernetting isthe method used for combining the smaller ranges of addresses into larger space. • several networks are merged into a single network
  • 74.
  • 75.
    Classless Addressing • Toreduce the wastage of IP addresses in a block, we use Classless Addressing • the classless addressing assigns a block of addresses to the customer according to its requirement which prevents the wastage of addresses. • variable-length blocks are used that belong to no classes. • This block contains the required number of IP Addresses as demanded by the user. • The classless IPv4 addressing does not divide the address space into classes like classful addressing. It provides a variable-length of blocks, which have a range of addresses according to the need of users. • This block of IP Addresses is called as a Classless Inter Domain Routing (CIDR) block.
  • 76.
    • The 32binary bits are broken into four octets (1 octet = 8 bits). • Each octet is converted to decimal and separated by a period (dot). • The value in each octet ranges from 0 to 255 decimal, or 00000000 to11111111 binary. 1 1 1 1 1 1 1 1 128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255) Here is a sample octet conversion when not all of the bits are set to 1. 0 1 0 0 0 0 0 1 0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65) And this sample shows an IP address represented in both binary and decimal.
  • 77.
    Class A network(netID),node (Host ID),node,node Class B network,network,node,node Class C network,network,network,node In a Class A address : network address of 0.0.0.0 – 255.0.0.0 In a Class B address : network address of 0.0.0.0 – 255.255.0.0 In a Class C address : network address of 0.0.0.0 – 255.255.255.0
  • 78.
    Variable-Length Blocks • Thewhole address space (2^32 addresses) is divided into blocks of different sizes • In classless addressing, the whole address space is divided into variable length blocks. • Addresses have two parts: • subnet or prefix, The prefix in an address defines the block (network); • Host - defines the node (device).
  • 79.
    • The prefixin an address defines the block (network); • the suffix defines the node (device). • Define a block of 2 addresses, is that the number of addresses in a block needs to be a power of 2. Classless Addressing
  • 80.
    Network part (All1s) Host part (All 0s) Total no.of host connected in this network = 2 no.of zeros =216 - 2 (Here 2 is reserved IP and Network IP) =2¹⁴ = 2×2×2×2×2×2×2×2×2×2×2×2×2×2 = 16384 Network mask (only calculate all 1s) = 255.255.0.0
  • 82.
  • 83.
    172.31.0.0/18 (16th next value: To take next value to set subnetwork start)
  • 84.
    Last bit valueadd to previous : 32+32 64+32 96+32 128+32 168+32 192+32 224+32 ( 256 – not valid so stop the process )
  • 85.
    Extracting Information froman Address • Given any address in the block, to know three pieces of information about the block to which the address belongs: 1. the number of addresses, 2. the first address in the block, and 3. the last address. Since the value of prefix length, n, is given, we can • easily find these three pieces of information,
  • 86.
    Type 1 Technique: ExtractingInformation from an Address • three pieces of information about the block to which the address belongs: 1. the number of addresses - The number of addresses in the block is found as N = 232−n 2. the first address in the block - To find the first address, we keep the n leftmost bits and set the (32 − n) rightmost bits all to 0s. 3. the last address - To find the last address, we keep the n leftmost bits and set the (32 − n) rightmost bits all to 1s.
  • 87.
    Example • A classlessaddress is given as 167.199.170.82/27. We can find the above three pieces of information as follows. 1. The number of addresses in the network is 232 − n = 232 − 27 = 25 = 32 addresses. 2. Convert 167.199.170.82 into binary values 10100111 11000111 10101010 01010010 To fine First address: 167.199.170.64/27 10100111 11000111 10101010 01000000
  • 88.
    3. The lastaddress can be found by keeping the first 27 bits and changing the rest of the bits to 1s. Address: 167.199.170.82/27 10100111 11000111 10101010 01011111 Last address: 167.199.170.95/27 10100111 11000111 10101010 01011111
  • 89.
    Type 2 :Address Mask • Another way to find the first and last addresses in the block is to use the address mask. • The address mask is a 32-bit number in which the n leftmost bits are set to 1s and the rest of the bits (32 - n) are set to 0s. • A computer can easily find the address mask because it is the complement of (2(32 - n) - 1).
  • 90.
    Address Mask • Anotherway to find the first and last addresses in the block is to use the address mask. • find the address mask because it is the complement of (232 − n − 1). • 1. The number of addresses in the block N = NOT (mask) + 1. • 2. The first address in the block = (Any address in the block) AND (mask). • 3. The last address in the block = (Any address in the block) OR [(NOT (mask)].
  • 91.
    Network Address andMask 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 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
  • 92.
    Address Mask • Thereason for defining a mask in this way is that it can be used by a computer program to extract the information in a block, using the three bit-wise operations NOT, AND, and OR. 1. The number of addresses in the block N = NOT (mask) + 1. 2. The first address in the block = (Any address in the block) AND (mask). 3. The last address in the block = (Any address in the block) OR [(NOT (mask)].
  • 93.
    Address Mask • Aclassless address is given as 167.199.170.82/27. • We can find the above three pieces of information using the mask. • The mask in dotted-decimal notation is 256.256.256.224. • The AND, OR, and NOT operations can be applied to individual bytes
  • 94.
    • Number ofaddresses in the block: N = NOT (mask) + 1 = 00000000 00000000 00000000 00011111 = 0.0.0.31 + 1 = 32 addresses First address:167.199.170.64 First = (address) AND (mask) 10100111 11000111 10101010 01010010 11111111 11111111 11111111 11100000 -------------------------------------------------------- 10100111 11000111 10101010 01000000 --------------------------------------------------------- Last address: 167.199.170.95 Last = (address) OR (NOT mask) = 167.199.170.255 10100111 11000111 10101010 01010010 00000000 00000000 00000000 00011111 -------------------------------------------------------- 10100111 11000111 10101010 01011111 --------------------------------------------------------
  • 95.
  • 96.
  • 97.
    Example : BlockAllocation • An organization is granted a block of addresses with the beginning address 14.24.74.0/24. The organization needs to have 3 subblocks of addresses to use in its three subnets: one subblock of 10 addresses, one subblock of 60 addresses, and one subblock of 120 addresses. Design the subblocks.
  • 98.
    Solution • There are2 32 – 24 = 256 addresses in this block. • The first address is 14.24.74.0/24; • the last address is 14.24.74.255/24. • To satisfy the third requirement, we assign addresses to subblocks, starting with the largest and ending with the smallest one.
  • 99.
    • The numberof addresses in the largest subblock, which requires 120 addresses, is not a power of 2. We allocate 128 addresses. • The subnet mask for this subnet can be found as n1 = 32 - log2128 = 25. • The first address in this block is 14.24.74.0/25; the last address is 14.24.74.127/25
  • 100.
    • The numberof addresses in the second largest subblock, which requires 60 addresses, is not a power of 2 either. • We allocate 64 addresses. The subnet mask for this subnet can be found as n2 = 32 - log264 = 26. • The first address in this block is 14.24.74.128/26; • the last address is 14.24.74.191/26
  • 101.
    • The numberof addresses in the smallest subblock, which requires 10 addresses, is not a power of 2 either. We allocate 16 addresses. The subnet mask for this subnet can be found as • n3 = 32 - log216 = 28. • The first address in this block is 14.24.74.192/28; • the last address is 14.24.74.207/28. If we add all addresses in the previous subblocks, the result is 208 addresses, • Which means 48 addresses are left in reserve. The first address in this range is 14.24.74.208. • The last address is 14.24.74.255.
  • 103.
    Special Addresses • This-hostAddress : 0.0.0.0/32 is called the this-host address(It is used whenever • a host needs to send an IP datagram but it does not know its own address to use as the source address.
  • 104.
    Limited-broadcast Address • Theonly address in the block 255.255.255.255/32 is called the limited-broadcast address. • It is used whenever a router or a host needs to send a datagram to all devices in a network. • The routers in the network, however, block the packet having this address as the destination; • the packet cannot travel outside the network.
  • 105.
    Loopback Address • Theblock 127.0.0.0/8 is called the loopback address. • A packet with one of the addresses in this block as the destination address never leaves the host; it will remain in the host. Any address in the block is used to test a piece of software in the machine. For • example, we can write a client and a server program in which one of the addresses in the block is used as the server address. • We can test the programs using the same host to see if they work before running them on different computers
  • 106.
    Private Addresses • Fourblocks are assigned as private addresses: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and 169.254.0.0/16.
  • 107.
    Multicast Addresses • Theblock 224.0.0.0/4 is reserved for multicast addresses.
  • 108.
    Comparison Basis for comparisonSubnetting Supernetting Basic A process of dividing a network into subnetworks. A process of combining small networks into a larger network. Procedure The number of bits of network addresses is increased. The number of bits of host addresses is increased. Mask bits are moved towards Right of the default mask. Left of the default mask. Implementation VLSM (Variable-length subnet masking). CIDR (Classless interdomain routing). Purpose Used to reduce the address depletion. To simplify and fasten the routing process
  • 109.
    Consider the followingsubnet masks- • 255.0.0.0 • 255.128.0.0 • 255.192.0.0 • 255.240.0.0 • 255.255.0.0 • 255.255.254.0 • 255.255.255.0 • 255.255.255.224 • 225.255.255.240 For each subnet mask, find- 1. Number of hosts per subnet 2. Number of subnets if subnet mask belongs to class A 3. Number of subnets if subnet mask belongs to class B 4. Number of subnets if subnet mask belongs to class C 5. Number of subnets if total 10 bits are used for the global network ID
  • 110.
    Given subnet maskis 255.0.0.0 Q1: • Number of Net ID bits + Number of Subnet ID bits = 8 • Number of Host ID bits = 24 Q2: • Since number of Host ID bits = 24, • So Number of hosts per subnet = 224 – 2
  • 111.
    Q3: • If thegiven subnet mask belongs to class A, then number of Net ID bits = 8. • Substituting in the above equation, we get- • Number of Subnet ID bits = 8 – 8 = 0 • Thus, there will be only one single network Q4: • First two octets of the subnet mask are not completely filled with 1’s. • So, given subnet mask can not belong to class B.
  • 112.
    Q5: • First threeoctets of the subnet mask are not completely filled with 1’s. • So, given subnet mask can not belong to class C. Q6: • First 10 bits of the subnet mask are not completely filled with 1’s. • So, given subnet mask can not use 10 bits for the Network ID.
  • 113.
    Example : • GivenIP address 132.6.17.85 and default class B mask, find the beginning address (network address).
  • 114.
    Solution : • Thedefault 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.
  • 115.
    Subnet Mask Convert intosubnet mask • 11111111 11111111 11111111 00000000
  • 116.
    Convert into subnetmask • 11111111 11111111 11111111 00000000 • 255.255.255.0
  • 117.
    Method 1 :Example • A classless address is given as 167.199.170.82/27. • We can find the above three pieces of information as follows. 1. The number of addresses in the network is 232 - n • = 25 = 32 addresses.
  • 118.
    2. To findthe first address • The first address can be found by keeping the first 27 bits and changing the rest of the bits to 0s. • Address: 167.199.170.82/27 • 10100111 11000111 10101010 01010010 • First address: 167.199.170.64/27 • 10100111 11000111 10101010 01000000
  • 119.
    3.The last address •The last address can be found by keeping the first 27 bits and changing the rest of the bits to 1s. • Address: 167.199.170.82/27 • 10100111 11000111 10101010 01011111 • Last address: 167.199.170.95/27 • 10100111 11000111 10101010 01011111