1. Gyanastra
  2. Computer Networks
  3. ARP and RARP
  4. ARP Request and Reply Working (Broadcast Request, Unicast Reply)
Free lesson, no account needed 6 min read 26 practice questions after it
Asked in past papers2 times
  • GATE CSE20212019

Computer Networks · ARP and RARP

ARP Request and Reply Working (Broadcast Request, Unicast Reply)

Overview

ARP (Address Resolution Protocol) sits between the network layer (IP) and the data link layer, and its job is to find the MAC address that corresponds to a given destination IP address so that an IP datagram can be placed inside a data link layer frame.
The data link layer does not discover the destination MAC address itself; ARP supplies it. The mechanism works through a broadcast request and a unicast reply.

Key concepts

  • ARP (Address Resolution Protocol): works between the network layer (IP) and the data link layer; given a destination IP address, it finds the corresponding MAC address so the IP datagram can be placed inside a data link layer frame.
  • Role of the data link layer: it does not discover the destination MAC address. It only needs (i) the packet from the IP layer and (ii) the MAC address supplied by ARP.
  • ARP request: a broadcast — the destination MAC address is all ones.
  • ARP reply: a unicast — sent only back to the requester.
  • Same network vs. different network: decided using the subnet mask.
    If the destination is in the same network, the frame carries the destination host's own MAC address; if it is in another network, the frame carries the router's MAC address.

How it works

  1. Host A (which may be a router) wants to send a message to host B. A first decides, using the subnet mask, whether B is in the same network or a different network. Assume B is in the same network.
  2. The packet comes down from the upper layers to IP. IP hands it to ARP, which resolves the MAC address and hands the result to the data link layer, which builds the frame.
  3. At the network layer the datagram has source IP address IAI_A and destination IP address IBI_B. A does not yet know B's MAC address.
  4. ARP creates an ARP request packet: "I know your IP address is IBI_B, but I do not know your MAC address. Please send me your MAC address if you are in the same network."
  5. The request is put in a frame with source MAC address MAM_A and destination MAC address all ones (because the destination MAC is unknown).
    All ones means broadcasting, so every station on the network sees the request, but only the station whose IP address is IBI_B (B) replies.
  6. B prepares the ARP reply: "My IP address is IBI_B and my MAC address is MBM_B." The reply frame has source MAC address MBM_B and destination MAC address MAM_A — B knows MAM_A because the request stated it came from MAM_A.
  7. A now learns that B's MAC address is MBM_B. The actual data packet is placed in a frame with destination MAC address MBM_B and source MAC address MAM_A.
  8. In general, whenever any packet is given to IP, IP gives it to ARP before the data link layer.
    ARP finds the MAC address for the destination IP address and passes it to the data link layer along with the IP packet, so the data link layer has all the information it needs.

Formulas

ARP request frame: source MAC=MA, destination MAC=all ones (broadcast)\text{ARP request frame: source MAC} = M_A,\ \text{destination MAC} = \text{all ones (broadcast)} ARP reply frame: source MAC=MB, destination MAC=MA (unicast)\text{ARP reply frame: source MAC} = M_B,\ \text{destination MAC} = M_A\ \text{(unicast)} Data frame (same network): source MAC=MA, destination MAC=MB\text{Data frame (same network): source MAC} = M_A,\ \text{destination MAC} = M_B

  • IAI_A: IP address of host A
  • IBI_B: IP address of host B
  • MAM_A: MAC address of host A
  • MBM_B: MAC address of host B

Worked examples

A sends to B, with B in the same network:

  1. A checks the subnet mask and concludes B is in the same network.
  2. IP datagram at A: source IP = IAI_A, destination IP = IBI_B.
  3. ARP request frame (broadcast): source MAC = MAM_A, destination MAC = all ones; content: "Who has IP IBI_B? Tell me your MAC address."
  4. All stations receive the broadcast; only B (IP = IBI_B) responds.
  5. ARP reply frame (unicast): source MAC = MBM_B, destination MAC = MAM_A; content: "IBI_B is at MBM_B."
  6. Actual data frame from A to B: source MAC = MAM_A, destination MAC = MBM_B.

Comparison

PropertyARP RequestARP Reply
Destination MACAll ones (broadcast)MAM_A (unicast)
Source MACMAM_AMBM_B
Who receives itEvery station on the networkOnly the requester (A)
Who responds/actsOnly the station with IP = IBI_BA (learns MBM_B)

Revision summary

  • ARP sits between the IP layer and the data link layer; it resolves an IP address to a MAC address.
  • The data link layer does not find the destination MAC address — ARP supplies it together with the IP packet.
  • Whether the destination is in the same network is decided using the subnet mask.
  • Same network → frame's destination MAC = destination host's MAC;
    different network → frame's destination MAC = router's MAC.
  • ARP request is broadcast (destination MAC all ones); ARP reply is unicast (back to the requester's MAC).
  • The request includes the source MAC MAM_A, which is how B knows to unicast the reply to MAM_A.
  • After the reply, the actual data frame uses destination MAC = MBM_B and source MAC = MAM_A.

Previous-year exam insights

  • ARP is used only within the same subnet/LAN; to reach a host in a different network, the sender ARPs for the IP address of the default gateway (router) and puts the router's MAC address as the frame's destination MAC, while the destination IP in the datagram remains the final host's IP.
    Asked inGATE 2019
  • ARP request is sent as a link-layer broadcast (destination MAC all ones) but is addressed at the IP level to the target host's IP; the reply is unicast directly to the requester's MAC address, so the destination MAC of an ARP reply is never a broadcast address.
    Asked inGATE 2021
  • ARP is a network-layer-to-link-layer address resolution protocol that operates within the local link; it is not used to resolve addresses across routers, and routers do not forward ARP broadcasts.
    Asked inGATE 2019
  • ARP messages are carried directly in link-layer frames (e.g., Ethernet type 0x0806) and are not encapsulated in IP datagrams or UDP; ARP packets therefore have no IP header.
  • To reduce broadcast traffic, resolved IP-to-MAC bindings are kept in an ARP cache with a timeout; gratuitous ARP (an unsolicited request/reply for one's own IP) is used to detect duplicate IP addresses and to update other hosts' caches after a change.
  • RARP (Reverse ARP) performs the reverse mapping, MAC address to IP address, and was used by diskless hosts to obtain their IP address from a RARP server; it is broadcast at the link layer and has been largely replaced by BOOTP/DHCP.
Pages 1–2 of 2