Chapter 19 of 28

ARP, DHCP & ICMP

When a device joins a network and starts communicating, several protocols work quietly in the background. Three important ones are ARP, DHCP, and ICMP.

They solve different problems:

  • ARP → Finds the MAC address associated with an IPv4 address on the local network.

  • DHCP → Automatically provides IP configuration to devices.

  • ICMP → Carries control, error, and diagnostic messages for IP networks.

Let's understand each one with simple examples.


1. ARP

ARP (Address Resolution Protocol) is used in IPv4 networks to find the MAC address associated with a known IPv4 address on the local network.

Remember, an IP address and a MAC address have different jobs.

IP Address  → Network-layer address
MAC Address → Link-layer address

Suppose your computer wants to send data to:

IP Address: 192.168.1.20

Your computer knows the destination IP, but to send an Ethernet frame on the local network, it also needs the destination MAC address.

ARP helps find it.

How ARP Works

Suppose:

Your PC
IP: 192.168.1.10

Other PC
IP: 192.168.1.20

Your PC can send an ARP request asking:

"Who has 192.168.1.20?"

The device using that IP responds with its MAC address.

PC A ── ARP Request ──→ Local Network
                         ↓
                    PC B has 192.168.1.20
                         ↓
PC A ←─ ARP Reply ────── MAC Address

The result can be stored temporarily in the computer's ARP cache.

Important Point

ARP is used for IPv4. IPv6 uses Neighbor Discovery Protocol (NDP) instead.


2. DHCP

DHCP (Dynamic Host Configuration Protocol) automatically provides network configuration to devices.

When you connect your laptop or phone to a network, you normally don't have to manually enter an IP address. DHCP can provide the required configuration automatically.

DHCP can provide information such as:

  • IP address

  • Subnet mask or prefix information

  • Default gateway

  • DNS server information

  • Lease duration

Why Do We Need DHCP?

Imagine an office with 500 computers.

Manually configuring every computer would be time-consuming and could easily lead to mistakes.

Instead:

Device → DHCP Server → Network Configuration

The DHCP server can automatically assign appropriate configuration.


DHCP Process

The initial DHCP exchange in IPv4 is commonly remembered using DORA:

D → Discover

O → Offer

R → Request

A → Acknowledgment

1. DHCP Discover

The client broadcasts a message to discover available DHCP servers.

2. DHCP Offer

A DHCP server responds with an offer containing network configuration.

3. DHCP Request

The client requests the offered configuration.

4. DHCP Acknowledgment

The server confirms the assignment.

Client                  DHCP Server

  |── DHCP Discover ───────→|
  |←── DHCP Offer ──────────|
  |── DHCP Request ─────────→|
  |←── DHCP ACK ─────────────|

After this process, the device can use the assigned network configuration.


3. ICMP

ICMP (Internet Control Message Protocol) is used by IP networks to exchange control, error-reporting, and diagnostic messages.

It is not normally used to carry application data like HTTP.

Instead, it helps devices and network tools understand what is happening with IP communication.

Example: Ping

One of the most familiar uses of ICMP is the ping command.

When you run:

ping 8.8.8.8

your device can send an ICMP Echo Request.

If the destination responds, it sends an ICMP Echo Reply.

Your Computer
      |
      | Echo Request
      ↓
Destination
      |
      | Echo Reply
      ↓
Your Computer

This helps test whether a destination is reachable and measure the round-trip time.


Common ICMP Messages

Some important ICMP message types include:

ICMP Message

Purpose

Echo Request

Used by ping to test connectivity

Echo Reply

Response to an Echo Request

Destination Unreachable

Indicates that a destination or service cannot be reached

Time Exceeded

Indicates that a packet's TTL was exhausted

Redirect

Can inform a host about a better next-hop route

ICMP has different message formats for IPv4 and IPv6.


ARP vs DHCP vs ICMP

Although all three are networking protocols, they solve completely different problems.

Protocol

Main Purpose

Simple Question

ARP

Finds MAC address for an IPv4 address on the local network

"Who has this IP?"

DHCP

Automatically provides IP configuration

"How should I configure my network?"

ICMP

Carries control, error, and diagnostic messages

"Can I reach it, and what went wrong?"


How They Can Work Together

Imagine you connect your laptop to your home network and open a website.

Several things can happen:

Step 1: DHCP

Your laptop uses DHCP to obtain an IP address, subnet information, default gateway, and possibly DNS server information.

Laptop → DHCP → Network Configuration

Step 2: ARP

If your laptop needs to send an IPv4 packet to a device on the local network, it may use ARP to discover the appropriate local MAC address.

IPv4 Address → ARP → MAC Address

Step 3: IP Communication

The packet can then be sent across the network.

Step 4: ICMP

If there is a routing or delivery problem, ICMP may provide an error message. Tools such as ping also use ICMP for connectivity testing.

So, these protocols can participate in different parts of the networking process, even though they have completely different responsibilities.


Easy Way to Remember

Think of them as three different questions:

ARP → "What MAC address belongs to this IPv4 address?"

DHCP → "Give me my network configuration."

ICMP → "Can I reach this destination, or is there a network problem?"

Conclusion

ARP, DHCP, and ICMP are important protocols that support IP networking.

  • ARP connects IPv4 addressing with local MAC addressing.

  • DHCP automatically configures devices with network information.

  • ICMP provides control, error-reporting, and diagnostic functionality.

Understanding these three protocols makes it much easier to understand what happens when a device joins a network, communicates locally, or troubleshoots an IP connection.