codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Subjects
🌐

Computer Networks

26 chapters

1Network Topologies & LAN/WAN2Network Devices (Hub, Switch, Router)3OSI Reference Model4OSI Model & TCP/IP Suite5TCP/IP Protocol Suite6Switching Techniques (Circuit, Packet)7Data Link: Framing & Error Detection8Error Correction (Hamming Code)9Flow Control (Stop-and-Wait, Sliding Window)10MAC: CSMA/CD & CSMA/CA11Network Layer & Routing12IP Addressing (IPv4, IPv6)13Subnetting & CIDR14Routing Algorithms (Distance Vector, Link State)15ARP, ICMP, and NAT16DHCP Protocol17Transport Layer Services18Transport Layer: UDP19Transport Layer: TCP & 3-Way Handshake20TCP Congestion Control21Application Layer: DNS & HTTP22Application Layer: SMTP & FTP23Socket Programming Basics24Wireless Networks & Wi-Fi Standards25VLANs & Spanning Tree Protocol26Network Security & Cryptography
SubjectsComputer Networks

ARP, ICMP, and NAT

Updated 2026-04-22
3 min read

ARP, ICMP, and NAT

While the IP protocol handles the core routing of packets, it cannot function entirely on its own. It relies heavily on several auxiliary protocols and mechanisms to resolve physical addresses, report errors, and conserve the global address space.

1. ARP (Address Resolution Protocol)

If Computer A wants to send an IP packet to Computer B on the same local network, knowing Computer B's IP address (192.168.1.10) is not enough. To actually send electrical signals over the Ethernet cable, Computer A needs Computer B's physical MAC Address.

ARP bridges the gap between Layer 3 (IP Addresses) and Layer 2 (MAC Addresses).

How ARP works:

  1. Computer A checks its internal ARP Cache to see if it already knows the MAC address for 192.168.1.10.
  2. If it doesn't, Computer A sends an ARP Request packet as a massive broadcast to every device on the local network. The packet essentially screams: "Who has IP 192.168.1.10? Tell 192.168.1.5!"
  3. Every computer receives the broadcast, but only Computer B matches the IP.
  4. Computer B sends a unicast ARP Reply directly back to Computer A, saying: "I am 192.168.1.10, and my MAC address is 00:1A:2B:3C:4D:5E."
  5. Computer A caches this information and finally transmits the actual data frame.

2. ICMP (Internet Control Message Protocol)

IP is a "best-effort" protocol; it provides no error reporting. If a router drops a packet because a link is down or the Time-To-Live (TTL) expired, it needs a way to tell the original sender what went wrong.

ICMP is used by routers and hosts to communicate network-level error messages and operational information. It runs directly on top of IP.

Common Uses of ICMP:

  • Ping: When you type ping google.com in your terminal, your computer sends an ICMP Echo Request. Google's server replies with an ICMP Echo Reply. This measures the round-trip latency.
  • Traceroute: By sending packets with deliberately small TTL values, routers along the path will drop the packets and reply with an ICMP Time Exceeded error, allowing you to map the exact path your data takes across the globe.
  • Destination Unreachable: If a router doesn't have a route to the destination IP, it drops the packet and sends this ICMP error back to you.

3. NAT (Network Address Translation)

In the late 1990s, the world realized it was going to run out of the 4.3 billion available IPv4 addresses very quickly. NAT was invented as a temporary band-aid to save IPv4, and it became so successful that it is now standard in every home router.

NAT allows an entire private network of devices (laptops, phones, smart TVs) to share a single public IP address when communicating with the global Internet.

How NAT works:

  1. Your home network uses private IP addresses (e.g., 192.168.1.x). These addresses are strictly banned from the public Internet.
  2. When your laptop (192.168.1.50) sends a web request to Google, the packet hits your home router.
  3. The router intercepts the packet. It strips out your private IP address from the Source IP field, and replaces it with the Router's singular Public IP Address assigned by your ISP.
  4. The router records this translation in its NAT Table (mapping the request to your laptop's specific internal IP and port).
  5. When Google replies, the packet arrives at the router. The router looks up the NAT Table, translates the destination IP back to 192.168.1.50, and forwards it to your laptop. Google is completely unaware that your laptop exists; it only ever sees the router.


PreviousRouting Algorithms (Distance Vector, Link State)NextDHCP Protocol

Recommended Gear

Routing Algorithms (Distance Vector, Link State)DHCP Protocol