Professional Documents
Culture Documents
Network Layer
Network Layer
Network Layer
Sunil Kumar Singh
SCOPE
Module 4
Contents
• Network layer’s Introduction
• IPv4
• Classful Addressing
• Subnetting
• IPv6
• Classless Addressing
• DHCP
• ARP and RARP
Module 4
IP as a Routed Protocol
IP is a connectionless,
unreliable, best-effort delivery
protocol.
IP accepts whatever data is
passed down to it from the
upper layers and forwards the
data in the form of IP Packets.
All the nodes are identified
using an IP address.
Packets are delivered from the
source to the destination using
IP address
Module 4
Packet Propagation
Module 4
IPv4 Address
IP address is for the INTERFACE of a host. Multiple
interfaces mean multiple IP addresses, i.e., routers.
32 bit IP address in dotted-decimal notation for ease
of reading, i.e., 193.140.195.66
Address 0.0.0.0, 127.0.0.1 and 255.255.255.255
carries special meaning.
IP address is divided into a network number and a
host number.
Also bits in Network or Host Address cannot be all 0
or 1.
Module 4
Classful addressing
• IP addresses, when started a few decades
ago, used the concept of classes
• In the mid-1990s, a new architecture, called
classless addressing, was introduced
• We will discuss classful addressing in this
section, first. Classless addressing will be
discussed in next section.
Module 4
IPv4 Address
Module 4
IPv4 Classes
Module 4
IPv4 Classes
Class A : Address begins with bit 0. It has 8 bit
network number (range 0.0.0.0-to-127.255.255.255),
24 bit host number.
Class B : Address begins with bits 10. It has 16 bit
network number (range 128.0.0.0-to-
191.255.255.255), 16 bit host number.
Class C : Address begins with bits 110. It has 24 bit
network number (range 192.0.0.0-to-
223.255.255.255), 8 bit host number.
Class D : Begins with 1110, multicast addresses
(224.0.0.0-to-239.255.255.255)
Class E : Begins with 11110, unused
Module 4
• Hexadecimal Notation
0111 0101 1001 0101 0001 1101 1110 1010
75 95 1D EA
0x75951DEA
- 8 hexadecimal digits
- Used in network programming
Module 4
Examples
• Change the following IPv4 addresses from binary
notation to dotted-decimal notation
a. 10000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 11100111 11011011 10001011 01101111
d. 11111001 10011011 11111011 00001111
• Solution
We replace each group of 8 bits with its equivalent decimal
number (see Appendix B) and add dots for separation.
a. 129.11.11.239
b. 193.131.27.255
c. 231.219.139.111
d. 249.155.251.15
Module 4
Class A
• Only 1 byte in class A defines the netid
• The leftmost bit should be ‘0’
• Class A is divided into 27 = 128 blocks
• Each block in class A contains 16,777,216
addresses
Module 4
Blocks in Class A
Class B
• 2 bytes in class B define the netid
• The two leftmost bits should be ‘10’
• Class B is divided into 214 = 16,384 blocks
• Each block in class B contains 65,536
addresses
Module 4
Blocks in Class B
Class C
• 3 bytes in class C define the netid
• The three leftmost bits should be ‘110’
• Class C is divided into 221 = 2,097,152
blocks
• Each block in class C contains 256
addresses
Module 4
Blocks Class C
Module 4
Class C
• Class E
– Reserved for future purposes
Module 4
Network addresses
Example
Given the address 23.56.7.91, find the network address.
Solution:
The class is A. Only the first byte defines the netid. We can find the network
address by replacing the hostid bytes (56.7.91) with 0s. Therefore, the
network address is 23.0.0.0.
Network Mask
• Used to extract the network address from
the destination address of a packet
• Called a default mask
Module 4
Example
A router receives a packet with the destination address
201.24.67.32. Show how the router finds the network address
of the packet.
Solution
Since the class of the address is C, we assume that the
router applies the default mask for class C, 255.255.255.0
to find the network address.
• Destination address -> 201 . 24 . 67 . 32
Default mask
In Dotted-
Class In Binary Using Slash
Decimal
Subnetting
• The organization that was granted a block in class A or B
needed to divide its large network into several subnetworks
for better security and management.
• In subnetting, a network is divided into several smaller
subnetworks with each subnetwork having its own
subnetwork address.
• Three level of addressing.
Module 4
Subnet mask
Module 4
4 Subnets
Module 4
Examples
An address in a block is given as 73.22.17.25. Find the
number of addresses in the block, the first address, and the
last address.
Solution
1. The number of addresses in this block is
N = 232-n = 224 = 16,777,216
2. To find the first address, we keep the left most 8 bits and
set the rightmost 24 bits all to 0s. The first address is
73.0.0.0/8 in which 8 is the value of n.
3. To find the last address, we keep the leftmost 8 bits and
set the rightmost 24 bits all to 1s. The last address is
73.255.255.255
Module 4
Examples
Q1. What is the maximum number of IP addresses that can be assigned to
hosts on a local subnet that uses the 255.255.255.224 subnet mask?
Solution:
A /27 (255.255.255.224) is 3 bits on and 5 bits off. This provides 8 subnets,
each with 30 hosts.
Q2. You need to subnet a network that has 5 subnets, each with at least
16 hosts. Which classful subnet mask would you use?
Options:
A. 255.255.255.192
B. 255.255.255.224
C. 255.255.255.240
D. 255.255.255.248
Solution:
You need 5 subnets, each with at least 16 hosts. The mask 255.255.255.240
provides 16 subnets with 14 hosts-this will not work. The mask 255.255.255.224
provides 8 subnets, each with 30 hosts. This is the best answer.
Module 4
Problems
Question:
Suppose a network with IP Address 192.16.0.0. is divided into 2 subnets, find
number of hosts per subnet.
Also for the first and second subnet, find-
1.Subnet Address
2.First Host ID
3.Last Host ID
4.Broadcast Address
Solution-
Problems
Classless Addressing
• Classful address did not solve the address depletion
problem
Distribution of addresses and the routing process more
difficult
Classless adressing
• Classless Addressing is an improved IP Addressing system.
• It makes the allocation of IP Addresses more efficient.
• It replaces the older classful addressing system based on
classes.
• It is also known as Classless Inter Domain Routing (CIDR).
CIDR Block-
When a user asks for specific number of IP Addresses,
• CIDR dynamically assigns a block of IP Addresses based on certain rules.
• This block contains the required number of IP Addresses as demanded by the
user.
• This block of IP Addresses is called as a CIDR block.
Module 4
CIDR Notation
CIDR IP Addresses look like-
a.b.c.d / n
• They end with a slash followed by a number called as IP network prefix.
• IP network prefix tells the number of bits used for the identification of
network.
• Remaining bits are used for the identification of hosts in the network.
Example-
Examples
Question:
Given the CIDR representation 20.10.30.35 / 27. Find the range of IP
Addresses in the CIDR block.
Solution-
Special addresses
• In classful addressing some addresses were
reserved for special purposes. The classless
addressing scheme inherits some of these
special addresses from classful addressing
• Special block
All-Zero Address
All-One Address
Loopback Address
Private Address
Multicast Address
• Special address in each block
Network Address
Direct broadcast address
Module 4
IP Datagram
Module 4
IPv6
Internet Protocol
IP Configuration of an Interface
Static DHCP
Internet Protocol
ARP
ARP (Address Resolution Protocol) is used in
Ethernet Networks to find the MAC address of a
node given its IP address.
Source node (say 192.168.2.32) sends broadcast
message (ARP Request) on its subnet asking ``Who
is 192.168.2.33’’.
All computers on subnet receive this request
Destination responds (ARP Reply) since it has
192.168.2.33
Provides its MAC address in response
Internet Protocol
ARP Process
Internet Protocol
IPv6
IPv6 uses 128 bit address instead of 32 bit address.
The IPv6 addresses are being distributed and are
supposed to be used based on geographical
location.