0% found this document useful (0 votes)
49 views102 pages

Understanding IP Addresses and Classful Addressing

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

Understanding IP Addresses and Classful Addressing

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

IP Addresses

Classful Addressing
INTRODUCTION
An IP address is a 32-bit address.

The IP addresses are unique.


Address Space
…………..
addr1 …………..
addr15
addr2 ………….. …………..
…………..
addr41 addr226
addr31
………….. …………..
RULE:
If a protocol uses N bits to define
…………..an address,
addr1 space is 2N because each bit can
the address
addr15
have two addr2
different values (0 and 1)
………….. and N
…………..
…………..
bits can have 2N values.
addr41 addr226
addr31
The address
…………..space of IPv4 is …………..
2 32
or
4,294,967,296
Binary Notation

01110101 10010101 00011101 11101010


Dotted-decimal notation
Hexadecimal Notation

0111 0101 1001 0101 0001 1101 1110 1010

75 95 1D EA

0x75951DEA
Example 1

Change the following IP address from binary


notation to dotted-decimal notation.
10000001 00001011 00001011 11101111

Solution

129.11.11.239
Example 2

Change the following IP address from


dotted-decimal notation to binary notation.
111.56.45.78

Solution
01101111 00111000 00101101 01001110
Example 3

Find the error, if any, in the following IP


address:
111.56.045.78

Solution

There are no leading zeroes in


dotted-decimal notation (045).
Example 3 (continued)

Find the error, if any, in the following IP


address:
75.45.301.14

Solution

In dotted-decimal notation, each number is


less than or equal to 255; 301 is outside
this range.
Example 4

Change the following IP addresses from


binary notation to hexadecimal notation.
10000001 00001011 00001011 11101111

Solution

0X810B0BEF or 810B0BEF16
CLASSFUL
ADDRESSING
IP Addressess
• IP is a network layer - it must be capable of providing
communication between hosts on different kinds of networks
(different data-link implementations).

• The address must include information about what network the


receiving host is on. This is what makes routing feasible.

• IP addresses are logical addresses (not physical)32 bits.[ IPv4]


• Includes a network ID and a host ID.
• Every host must have a unique IP address.
• IP addresses are assigned by a central authority (American Registry for
Internet Numbers for North America).
Hierarchy in addressing
In classful addressing,
the address space is
divided into five classes:
A, B, C, D, and E.
Classful IP Address
Occupation of the address space

231(50%)

229(12.5%) 228(6.25%)
The four formats of IP Addresses
Class
A 0 NetID HostID

B 10 NetID HostID

C 110 NetID HostID

D 1110 Multicast Address


8 bits 8 bits 8 bits 8 bits
Example 1
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution

a. The first bit is 0. This is a class A address.


b. The first 2 bits are 1; the third bit is 0. This is a
class C address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
Network and Host IDs
• A Network ID is assigned to an organization by a
global authority.

• Host IDs are assigned locally by a system


administrator.

• Both the Network ID and the Host ID are used for


routing.
IP Addresses
• IP Addresses are usually shown in dotted
decimal notation:
1.2.3.4 00000001 00000010 00000011 00000100

• cs.rpi.edu is 128.213.1.1
10000000 11010101 00000001 00000001
CS has a class B network
Blocks in class A
Millions of class A addresses
are wasted.
Blocks in class B
Many class B addresses
are wasted.
Blocks in class C
The number of addresses in
a class C block
is smaller than
the needs of most organizations.
Class D addresses
are used for multicasting;
there is only
one block in this class.
Class E addresses are reserved
for special purposes;
most of the block is wasted.
Network Addresses

The network address is the first address.

The network address defines the network to the


rest of the Internet.
Given the network address,we can find the
class of the address, the block, and the range of
the addresses in the block.
In classful addressing,
the network address
(the first address in the block)
is the one that is assigned
to the organization.
Example 9

Given the network address 17.0.0.0, find the


class, the block, and the range of the
addresses.

Solution

The class is A because the first byte is between


0 and 127. The block has a netid of 17.
The addresses range from 17.0.0.0 to
17.255.255.255.
Example 10

Given the network address 132.21.0.0, find


the class, the block, and the range of the
addresses.

Solution

The class is B because the first byte is between


128 and 191. The block has a netid of
132.21. The addresses range from
132.21.0.0 to 132.21.255.255.
Example 11

Given the network address 220.34.76.0, find


the class, the block, and the range of the
addresses.
Solution
The class is C because the first byte is
between 192 and 223. The block has a netid of
220.34.76.The addresses range from
220.34.76.0 to 220.34.76.255.
Address Depletion
• The reason that classful addressing has become obsolete is address depletion. Since
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.

• To understand the problem, let us think about class A. This class can be assigned to
only 128 organizations in the world, but each organization needs to have a single
network (seen by the rest of the world) 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).
Classless Addressing
• In 1996, the Internet authorities announced a new architecture called classless
addressing. In classless addressing, variable-length blocks are used that belong to no
classes. We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses,
and so on. In classless addressing, the whole address space is divided into variable
length blocks. The prefix in an address defines the block (network); the suffix
defines the node (device).
• Unlike classful addressing, the prefix length in classless addressing is variable. We
can have a prefix length that ranges from 0 to 32. The size of the network is
inversely proportional to the length of the prefix. A small prefix means a larger
network; a large prefix means a smaller network.
Prefix Length: Slash Notation

• The first question that we need to answer in classless addressing is how to


find the prefix length if an address is given. Since the prefix length is not
inherent in the address, we need to separately give the length of the
prefix. In this case, the prefix length, n, is added to the address, separated
by a slash. The notation is informally referred to as slash notation and
formally as classless interdomain routing or CIDR (pronounced cider)
strategy.
Extracting Information from an Address

• Given any address in the block, we normally like to know three pieces of
information about the block to which the address belongs: the number of
addresses, the first address in the block, and the last address. Since the value of
prefix length, n, is given, we can easily find these three pieces of information.
1. The number of addresses in the block is found as N = 232-n.
2. To find the first address, we keep the n leftmost bits and set the (32-n)
rightmost bits all to 0s.
3. To find the last address, we keep the n leftmost bits and set the (32 - n)
rightmost bits all to 1s.
Example
Mask
•Another way to find the first and last addresses in
the block is to use the address mask.
•A mask is a 32-bit number in which the n leftmost
bits are Is and the 32 - n rightmost bits are Os.
•However, in classless addressing the mask for a block
can take any value from 0 to 32. It is very convenient
to give just the value of n preceded by a slash (CIDR
notation).
•In IPv4 addressing, a block of addresses can be
defined as x.y.z.t/n in which x.y.z.t defines one of the
addresses and the In defines the mask.
Contd.
• 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.
Masking concept
AND operation
The network address is the
beginning address of each block.
It can be found by applying
the default mask to
any of the addresses in the block
(including itself).
It retains the netid of the block
and sets the hostid to zero.
Number of blocks and block size in classful IPv4 addressing

Default masks for classful addressing


Example 12

Given the address 23.56.7.91, find the


beginning address (network address).

Solution

The default mask is 255.0.0.0, which means


that only the first byte is preserved and the
other 3 bytes are set to 0s. The network
address is 23.0.0.0.
Example 13

Given the address 132.6.17.85 and, find the


beginning address (network address).

Solution

The default mask is 255.255.0.0, which


Means that the first 2 bytes are preserved
and the other 2 bytes are set to 0s. The
network address is 132.6.0.0.
Example 14

Given the address 201.180.56.5, find the


beginning address (network address).

Solution

The default mask is 255.255.255.0,


which means that the first 3 bytes are
preserved and the last byte is set to 0.
The network address is 201.180.56.0.
We must not
apply the default mask
of one class to
an address belonging
to another class.
CIDR (Classless Inter-Domain Routing) Notation

18.46.74.10/8 – Class A
141.24.74.69/16 - Class B
200.14.70.22/24 – Class C

Number of 1’s in the mask


Location, Not Names

• An internet address defines the network


location of a device, not its identity.

• Movement of Computer/ Node from one


network to another means that its IP address
must be changed.
Multihomed devices
•A Device has different address for each network connected to it. Such computers
are called as Multihomed Computers.

•Each of these addresses can belong to a different class.

•The router has more than one IP address, one for each interface.
Network addresses
Example of direct broadcast address
- Host IDs are all 1’s.
Example of limited broadcast address
Example of this host on this address
Example of specific host on this network
Loop back address
• IP address with first byte as 127[127.X.Y.Z]
• Used to test the s/w on a machine [ Here the
packet simply returns to the protocol s/w on
the same machine]
• Eg. Ping appln to test if the process is able to
receive and process a packet.
• Eg. Client process sending msg to server
process on the same machine.
Special Addresses
Special Address Netid Hostid Source or
Destination
Network address Specific All 0s None
Direct broadcast address Specific All 1s Destination

Limited broadcast All 1s All 1s Destination


address
The host on this network All 0s All 0s Source

Specific host on this All 0s Specific Destination


network
Loopback address 127 Any Destination
Example of loopback address
Private Addresses
• As the name suggests the private IP addresses are never used globally. The
packet with a private IP address is not routed on the internet. The private
IP addresses are configured by the administrator of the network. Devices
on the same network use private IP addresses to converse with each
other. They do not require the internet for their communication.
• But, when they want to communicate with the device out of their network
they translate a private IP address into the public IP address using NAT.
• The range of private IP addresses is given below:
Unicast, Multicast, and
Broadcast Addresses
Unicast communication is one-to-one.

Multicast communication is one-to-many.

Broadcast communication is one-to-all.


SUBNETTING
IP addresses are designed with
two levels of hierarchy.
Subnet Addresses
• An organization can subdivide it’s host address space
into groups called subnets.

• The subnet ID is generally used to group hosts based


on the physical network topology.

10 NetID SubnetID HostID


Hierarchy concept in a telephone number

Two levels: Netid & Hostid

Three levels: Netid : subnetid : Hostid


Default mask and subnet mask
Comparison of a default mask and
a subnet mask
Finding the Subnet Address
Given an IP address, we can find the
subnet address the same way we found the
network address. We apply the mask to the
address. We can do this in two ways:
straight or short-cut.
Straight Method
In the straight method, we use binary
notation for both the address and the
mask and then apply the AND operation
to find the subnet address.
Example 15

What is the subnetwork address if the


destination address is 200.45.34.56 and the
subnet mask is 255.255.240.0?
Solution

11001000 00101101 00100010 00111000


11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000

The subnetwork address is 200.45.32.0.


Short-Cut Method
** If the byte in the mask is 255, copy
the byte in the address.
** If the byte in the mask is 0, replace
the byte in the address with 0.
** If the byte in the mask is neither 255
nor 0, we write the mask and the address
in binary and apply the AND operation.
What is the subnetwork address if the
destination address is 19.30.84.5 and the
mask is 255.255.192.0?
The number of subnets must be
a power of 2.
A company is granted the site address
201.70.64.0 (class C). The company needs
six subnets. Design the subnets.
Solution

The number of 1s in the default


mask is 24 (class C).
Solution (Continued)

The company needs six subnets. 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.
The total number of 1s in the subnet mask is
27 (24  3).
The total number of 0s is 5 (32  27).
Solution (Continued)
The mask is

11111111 11111111 11111111 11100000


or
255.255.255.224

The number of subnets is 8.


The number of addresses in each subnet
is 25 (5 is the number of 0s) or 32.
A company is granted the site address
181.56.0.0 (class B). The company needs
1000 subnets. Design the subnets.
Solution

The number of 1s in the default mask is 16


(class B).
Solution (Continued)

The company needs 1000 subnets. 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.
The total number of 1s in the subnet mask is
26 (16  10).
The total number of 0s is 6 (32  26).
Solution (Continued)

The mask is
11111111 11111111 11111111 11000000
or
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.
SUPERNETTING
Comparison
Subnetting Supernetting
• 1’s are made more than the • 1’s are made less than the
default mask default mask
• A subnet mask divides a • A supernet combines n
block into subblocks [Eg. blocks into one superblock [
SITE, SCSE, SMBS] Combining several blocks]
A supernetwork

Why supernetwork?
1. Class C too small
2. Routing table efficiency
Comparison of subnet, default,
and supernet masks
We need to make a supernetwork out of 16
class C blocks. What is the supernet mask?
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 11110000 00000000
or
255.255.240.0
A supernet has a first address of 205.16.32.0 and a
supernet mask of 255.255.248.0. A router receives three
packets with the following destination addresses:
205.16.37.44
205.16.42.56
205.17.33.76
Which packet belongs to the supernet?
Solution

We apply the supernet mask to see if we 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.
A supernet has a first address of 205.16.32.0 and a
supernet mask of 255.255.248.0. How many blocks are in
this supernet and what is the range of addresses?

Solution

The supernet has 21 1s. The default mask has 24


1s. Since the difference is 3, there are 2 3 or 8
blocks in this supernet. The blocks are 205.16.32.0
to 205.16.39.0. The first address is 205.16.32.0.
The last address is 205.16.39.255.
Rules:
** 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 address in the
superblock must be evenly divisible by the number
of blocks. In other words, if the number of blocks is
N, the third byte must be divisible by N.
A company needs 600 addresses. Which of
the following set of class C blocks can be
used to form a supernet for this company?
198.47.32.0 198.47.33.0 198.47.34.0
198.47.32.0 198.47.42.0 198.47.52.0 198.47.62.0
198.47.31.0 198.47.32.0 198.47.33.0 198.47.34.0
198.47.32.0 198.47.33.0 198.47.34.0 198.47.35.0
Solution

1: No, there are only three blocks.


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.
A network with two levels of
hierarchy (not subnetted)

Why subnetting?

1. The transmissions of these hosts will affect one another.


2. Class B too large, wasteful.
3. Not easy to manage. (e.g., where is host 141.14.190.1?)
A network with three levels of
hierarchy (subnetted)
Addresses in a network with
and without subnetting
Note:

The idea of subnetting and


supernetting of classful addresses is
almost obsolete.

TCP/IP Protocol Suite 102

You might also like