← 🌐 IP Addressing & Network Layer
Subtopic 5 of 5

5.5ARP, DHCP, ICMP and NAT

The idea

ARP finds the MAC address for an IP address on the same LAN. DHCP hands out addresses. ICMP reports errors. NAT lets many private hosts share one public address.

Think of it like this: ARP is shouting "who is 10.0.1.1?" across a room. DHCP is the front desk giving you a room number. NAT is a company switchboard using one phone number for many desks.

Why it exists

GATE asks which MAC address a packet carries, whether ARP replies are broadcast, and which header fields change.

How it works

  1. A host sends to the gateway's MAC when the destination IP is off-subnet, and keeps the final destination IP.
  2. ARP request: broadcast. ARP reply: unicast.
  3. Router: decrements TTL, recomputes the header checksum, builds a new Ethernet header.
  4. NAT additionally rewrites the source IP (and port) and the transport checksum.

Worked example: X sends a packet to Y across an Ethernet switch S and router R.

Destination IP is Y's. Destination MAC is R's (the next hop), not Y's and not the switch's (GATE 2024).

Now play with it

  • →Step through the router example and compare the MACs before and after R.
  • →Notice that the IP addresses never change here.
  • Host A decides: B = 10.0.2.9 is NOT in my subnet 10.0.1.0/24, so I send to my default gateway R (10.0.1.1).
  • A broadcasts ARP: Who has 10.0.1.1? Ethernet destination FF:FF:FF:FF:FF:FF. R replies to A with its MAC R1 (unicast).
  • Frame on LAN 1: Ethernet: src MAC-A, dst MAC-R1. IP: src 10.0.1.5, dst 10.0.2.9, TTL 64.
  • Router R forwards: R strips the Ethernet header, decrements TTL, recomputes the IP checksum, looks up 10.0.2.9 (longest prefix) and ARPs for B on LAN 2.
  • Frame on LAN 2: Ethernet: src MAC-R2, dst MAC-B. IP: src 10.0.1.5, dst 10.0.2.9, TTL 63. IP addresses unchanged, MAC addresses new.
ProtocolJobRuns overKey fact
ARPIP address → MAC addressdirectly on Ethernetrequest is a broadcast, reply is unicast
DHCPlease an IP, mask, gateway, DNSUDP 67 and 68Discover, Offer, Request, Ack
ICMPerrors and diagnostics (ping, traceroute)inside IP (protocol 1)TTL exceeded, destination unreachable
NATshare one public IPat the border routerrewrites source IP and port, recomputes checksums

Check yourself

The destination MAC of an ARP request is

Remember: ARP request broadcast, reply unicast. Off-subnet: MAC of the gateway, IP of the destination. Router changes TTL and checksum.
Exam notes (the dense version)

ARP maps an IP address to a MAC address: the request is a broadcast (destination FF:FF:FF:FF:FF:FF), the reply is unicast. Hosts use ARP for the next hop: a packet to another network is addressed (at layer 2) to the router's MAC while keeping the final destination IP. DHCP hands out IP, mask, gateway and DNS (over UDP 67/68). ICMP carries errors and diagnostics (ping, traceroute, time exceeded). NAT rewrites the source IP (and port) of outgoing packets and recomputes the IP and TCP/UDP checksums; it breaks end-to-end addressing.

Previous year questions: IP Addressing & Network Layer (26)

PYQs are grouped by topic, so this is the full set for IP Addressing & Network Layer; try the ones that match this subtopic. Open all 26 on the topic page.