Network Layer
• The network layer is responsible for the source-to-destination
delivery of a packet, possibly across multiple networks (links).
Whereas the data link layer oversees the delivery of the packet
between two systems on the same network (links).
• the network layer ensures that each packet gets from its point of
origin to its final destination.
• The network layer adds a header that includes the logical
addresses/IP address of the sender and receiver to the packet
corning from the upper layer.
• If a packet travels through the Internet, we need this addressing
system to help distinguish the source and destination.
IPv4 Address
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.
IPv4 addresses are unique.
They are unique in the sense that each address defines one, and
only one, connection to the Internet.
Two devices on the Internet can never have the same address at
the same time.
If a device operating at the network layer has m connections to
the Internet, it needs to have m addresses.
Notations
There are two prevalent notations to show an IPv4 address: binary notation and
dotted-decimal notation.
Binary Notation
In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often
referred to as a byte.
The following is an example of an IPv4 address in binary notation:
01110101 10010101 00011101 00000010
Dotted-Decimal Notation
To make the IPv4 address more compact and easier to read, Internet addresses are
usually written in decimal form with a decimal point (dot) separating the bytes.
The following is the dotted-decimal notation of the above address:
[Link]
Dotted-decimal notation and binary notation for an IPv4 address
Example Problems
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.
Example Problems
Change the following IPv4 addresses from dotted-decimal notation
to binary notation.
Solution
We replace each decimal number with its binary equivalent.
Example Problems
Change the following IPv4 addresses from dotted-decimal notation
to binary notation.
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.
Classful addressing
In classful addressing, the address space is divided into five classes: A, B, C, D,
and E.
Each class occupies some part of the address space.
If the address is given in binary notation, the first few bits can immediately tell us the
class of the address.
If the address is given in decimal-dotted notation, the first byte defines the class.
Example Problems
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. [Link]
d. [Link]
19.13
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.