Computer Networks
IP Addresses
Dr. Ehsan Munir
Department of Computer Science
COMSATS University Islamabad, Wah Campus
ehsanmunnir@gmail.com
The slides are adapted from the publisher’s material
Data Communications and Networking by Behrouz A. Forouzan, 5th edition
Data and Computer Communications by William Stallings, 8th Edition
Computer Networking: A Top-Down Approach by J F Kurose, K W Ross, 6th Edition
Computer Networks, by L. Peterson, and B. Davie, 5th edition
Outline
◼ IP address
◼ a number identifying a computer or another
device on the Internet
◼ Classful IP addressing
2
IPv4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and
universally defines the connection of a device (for
example, a computer or a router) to the Internet.
3
Example
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.
Solution
We replace each decimal number with its binary
equivalent.
4
Example
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.
Solution
We replace each decimal number with its binary
equivalent.
5
Example
Change the following IPv4 addresses from binary
notation to dotted-decimal notation.
Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.
6
Example
Find the error, if any, in the following IPv4 addresses.
Solution
a.
7
Example
Find the error, if any, in the following IPv4 addresses.
Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
8
Hierarchy in Addressing
A 32-bit IPv4 address is 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). Figure shows the prefix and suffix of a 32-bit IPv4 address. The
prefix length is n bits and the suffix length is (32 - n) bits.
18.9
Classful Addressing
When the Internet started, an IPv4 address was designed with a fixed-length
prefix, but to accommodate both small and large networks, 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), as shown in Figure below. This scheme is referred to as classful
addressing. Although classful addressing belongs to the past, it helps us to
understand classless addressing, discussed later.
18.10
Classful Addressing
18.11
Example
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.
12
Example
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.
13