Network Layer
Part 1
Address mapping
By
Prof. Soumik Kumar Kundu
Asst. Prof., ECE Dept.
Address Mapping
• The internet is composed of physical networks connected by
devices like routers.
• Packets travel through multiple networks to reach their
destination, with hosts and routers identified by logical (IP)
addresses at the network level and physical addresses at the
physical level.
• Physical addresses, such as the 48-bit MAC address in Ethernet,
are local and unique within a network but not universally.
• Logical and physical addresses are necessary because different
network layers and protocols coexist. Packet delivery requires
mapping between these addresses, which can be done through
static or dynamic mapping.
• Static mapping uses a table associating logical and physical
addresses, but it needs periodic updates due to changes in
physical addresses.
• Dynamic mapping uses protocols to find the corresponding
address when one is known.
Mapping Logical to Physical Address: ARP
• When a host or router needs to send an IP datagram, it has the
receiver's logical (IP) address, obtained from DNS or a routing
table. The IP datagram must be encapsulated in a frame to pass
through the physical network, requiring the receiver's physical
address.
• The sender uses ARP (Address Resolution Protocol) to broadcast
a query packet containing its own physical and IP addresses and
the receiver's IP address.
• All devices on the network receive the ARP query, but only the
intended recipient recognizes its IP address and responds with
an ARP reply packet containing its physical address. This reply is
unicast directly to the sender.
• Once the sender has the physical address, it can send all
subsequent packets to the destination using this address.
ARP Operation Steps:
• The sender knows the target's IP address.
• ARP creates a request message with the sender's physical and IP
addresses, and the target's IP address (target physical address is
set to 0s).
• The message is encapsulated in a frame with the sender's physical
address as the source and the broadcast address as the destination.
• All hosts/routers receive the frame, but only the target recognizes
its IP address and processes the message.
• The target replies with an ARP reply message containing its
physical address, sent directly to the sender.
• The sender receives the reply and now knows the target's physical
address.
• The IP datagram is encapsulated in a frame and unicast to the
destination.
ARP Message Fields:
• Hardware type: 16-bit field defining the network type (e.g., Ethernet is type 1).
• Protocol type: 16-bit field defining the protocol (e.g., IPv4 is 0800).
• Hardware length: 8-bit field defining the length of the physical address in
bytes (e.g., 6 for Ethernet).
• Protocol length: 8-bit field defining the length of the logical address in bytes
(e.g., 4 for IPv4).
• Operation: 16-bit field defining the packet type (1 for ARP request, 2 for ARP
reply).
• Sender hardware address: Variable-length field defining the sender's physical
address (e.g., 6 bytes for Ethernet).
• Sender protocol address: Variable-length field defining the sender's logical
(IP) address (e.g., 4 bytes for IPv4).
• Target hardware address: Variable-length field defining the target's physical
address (all 0s in ARP request).
• Target protocol address: Variable-length field defining the target's logical (IP)
address (e.g., 4 bytes for IPv4).
Mapping Physical to Logical Address:
Reverse Address Resolution Protocol (RARP):
• Purpose: Finds the logical (IP) address for a machine that knows only
its physical address.
• Usage: Each host/router has unique logical IP addresses, independent
of physical addresses. Diskless machines, booted from ROM, use RARP
to obtain their IP address.
• Process:
The machine reads its physical address (e.g., from NIC).
It broadcasts a RARP request on the local network.
A RARP server on the network responds with the IP address.
• Limitations:
Broadcasting is limited to the local network.
Requires a RARP server for each network/subnet.
RARP is becoming obsolete, replaced by BOOTP and DHCP.
Bootstrap Protocol (BOOTP):
• Purpose: Provides physical address to logical address mapping.
• Layer: Application layer protocol.
• Operation:
BOOTP messages are encapsulated in UDP and IP packets.
The client uses all 0s as the source and destination IP
addresses.
The client and server can be on different networks.
A relay agent is used to forward the BOOTP request to the
server.
The relay agent knows the server's unicast address and
sends the request.
The server responds to the relay agent, which then forwards
the reply to the client.
Dynamic Host Configuration Protocol (DHCP):
• Purpose: Provides static and dynamic address allocation, either manually
or automatically.
• Static Address Allocation: Similar to BOOTP, with a database binding
physical addresses to IP addresses.
• Dynamic Address Allocation: Uses a pool of available IP addresses to
assign temporary addresses for a negotiable period.
• Operation:
DHCP server checks its static database for the requested physical
address.
If found, returns the permanent IP address.
If not found, assigns an IP address from the dynamic pool and
updates the database.
• Dynamic Aspect: Useful for hosts moving between networks or needing
temporary IP addresses.
• Lease: Temporary IP addresses are leased for a specific time, requiring
renewal upon expiration.
• Configuration: Allows both manual (static) and automatic (dynamic)
configurations.