You are on page 1of 11

Chapter 19

Network Layer:
Logical Addressing

Dr. Mznah Al-Rodhaan

Based on th
Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

19--1 IPv4 ADDRESSES


19

An IPv
IPv44 address is a 32
32--bit address that uniquely and
universally defines the connection of a device (for
example, a computer or a router) to the Internet
Internet..

Topics discussed in this section:


Address Space
Notations
Classful Addressing
Classless Addressing
Network Address Translation (NAT)

Based on th

19.2 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
An IPv4 address is 32 bits long.
1. Two devices in the Internet can never have the same
address at the same time.
2. An address may be assigned to a device for a time period
and then taken away and assigned to another device.
3. If a device operating at the network layer has m
connections to the Internet
Internet, it needs to have m
address.(e.g. router)

The IPv4 addresses are unique and universal.


Based on th

19.3 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

IPv4 Address Space


„ IPV4 address space is the total number of addresses
used by the protocol.
„ If a protocol uses N bits to define an address,
address the
address space is 2N .
„ IPv4 uses 32-bit address:
„ The address space=232=4,294,967,296 ( more than 4
billion)
„ This means, if there were no restrictions, more than 4
billion devices could be connected to the Internet.

Based on th

19.4 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
IPv4 Notations
„ There are two prevalent notations to show an IPv4 address:
„ Binary notation:
„ Address is displayed as 32 bits.
„ IP 4 address
IPv4 dd referred
f d tto as 32-bit
32 bit address
dd or 4-byte
4 b t address
dd
„ Example: 01110101 10010101 00011101 00000010
„ Dotted-decimal notation:
„ More compact and easier to read
„ Written in decimal form with a decimal point( dot) separating the bytes.
„ Example: 117.149.29.2
„ Each decimal value range from 0 to 255

Dotted-decimal notation and binary notation for an IPv4 address

Based on th

19.5 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Example 19.1

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 (see Appendix B) and add dots for
separation.

Based on th

19.6 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
Example 19.2
Change the following IPv4 addresses from dotted-decimal
notation to binary notation.

Solution
We replace each decimal number with its binary
equivalent
q ((see Appendix
pp B).
)

Based on th

19.7 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Example 19.3
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.
Based on th

19.8 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
Classful Addressing
„ In classful addressing, the address space is divided into
five classes: A, B, C, D, and E.
„ We can find the class of an address in:
„ Bi
Binary notation
t ti
„ The first few bits define the class
„ Decimal-dotted notation.
„ The first byte define the class

Based on th

19.9 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Classful Addressing

IIn classful
l f l addressing,
dd i the
th address
dd
space is divided into five classes:
A, B, C, D, and E.
Based on th

19.10 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
Classful Addressing

1 7 24

Class A 0 N t
Network
k H t
Host H t
Host H t
Host

2 16 16

Class B 10 Network Network Host Host

21 8
3

Class C 1 1 0 Network Network Network Host

Based on th

19.11 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Example 19.4

Find the class of each address.


a. 00000001 00001011 00001011 11101111
b 11000001 10000011 00011011 11111111
b.
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 1and the third bit is 0,
b. 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.
Based on th

19.12 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
Classes and Blocks
One problem is that each class is divided into fixed number of
blocks with each block having a fixed size

Based on th

19.13 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Classes and Blocks


„ Class A address: designed for large organizations with a large
number of attached hosts or routers. (wasted and not used)
„ Class B address: designed for midsize organizations with ten
of thousands of attached hosts or routers( too large for many
organizations)
„ Class C address: designed for small organizations with a
small number of attached hosts or routers.(too small for many
organizations)
„ Class D address: designed
g for multicasting.g ((waste of
addresses)
„ Class E address: reserved for future use (waste of addresses)

Based on th

19.14 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
Classes and Blocks
„ Netid and Hostid
„ The address is divided into netid and hostid.
„ These part are of varying lengths, depending on the class.
„ D
Dose not applyl to classes
l D andd E
„ Netid in color, hostid in black.

Based on th

19.15 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

Classes and Blocks

„ Mask
„ Help us to find the netid and hostid
„ Mask: 32-bit made of 1s followed by 0s.
„ Dose not apply to classes D and E.
„ CIDR(Classless Interdomain Routing): used to show the
mask in the form /n (n=8,16, or 24) in classful addressing
only

In classful addressing, a large part of the


available addresses were wasted.

Based on th

19.16 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
19.1 : Classful Addressing: Classes and Blocks

„ Subnet
„ Iff an organization
i i was grantedd a large
l block
bl k
in classes A or B
„ It could divide the addresses into several

contiguous groups and assign each group


to smaller networks ( subnets)
„ It increases the number of 1s in the mask.

Based on th

19.17 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

19.1 : Classful Addressing: Classes and Blocks


„ Supernetting
„ Huge demand for midsize blocks.

„ Although
Alth h class
l A andd B addresses
dd are almost
l t
depleted, class C addresses are still available( size
of block= 256 so address did not satisfy the needs).
„ In supernetting, an organization can combine

several class C blocks to create a larger range of


addresses
addresses.
„ Several networks are combined to create a

supernetwork( supernet).

Based on th

19.18 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
19.1 : Classful Addressing: Classes and Blocks
„ Supernetting
„ e.g. Organization needs 1000 address can be
granted
t d 4 contiguous
ti class
l C blocks.
bl k
„ Create one super network.
„ Decreases the number of 1s in the mask.
„ E.g. The mask changes from /24 to /22

Based on th

19.19 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan

19.1 : Classful Addressing: Classes and Blocks


„ Address Depletion
„ Near depletion of the available address
b
because off the
th fast
f t growth
th off the
th Internet.
I t t
„ Run out of classes A and B address.
„ Classes C block is too small for most mid
size organizations.
„ Sol tion: Classless addressing
Solution:

Based on th

19.20 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan
Classful addressing, which is almost
obsolete, is replaced with classless
addressing.

Based on th

19.21 Data Communications and Networking, 4 Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007 Dr. Mznah Al-Rodhaan