Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

NAT & ICMP
CN

NAT & ICMP

Hidden networks and diagnostic tools: Understand how NAT saves IPv4 and how ICMP helps troubleshoot.

NAT (Network Address Translation)

NAT allows multiple devices on a private network to share a single public IP address when accessing the internet. It was critical in extending IPv4’s lifespan.

How it works:

  • Devices behind NAT have private IPs (e.g., 192.168.1.10)
  • When they connect to the internet, the NAT router:
    1. Replaces the private source IP with its own public IP
    2. Assigns a unique source port for each connection
    3. Maintains a NAT table mapping (private IP:port → public IP:port)
    4. When response arrives, looks up the mapping and forwards to the correct internal device
TypeDescription
Static NATOne-to-one mapping between private and public IP
Dynamic NATPool of public IPs, assigned on demand
PAT (Port Address Translation)Many private IPs → one public IP (most common)

Security benefit: External hosts cannot initiate connections to devices behind NAT — the firewall blocks unsolicited inbound traffic.

ICMP (Internet Control Message Protocol)

ICMP is a Layer 3 protocol used for diagnostics and error reporting. It does NOT carry user data.

  • Ping — sends ICMP Echo Request, receives Echo Reply. Measures RTT (Round Trip Time), packet loss.
  • Traceroute — sends packets with incrementing TTL values. Each router that decrements TTL to 0 sends back an ICMP Time Exceeded message, revealing the path.

Common ICMP Messages

TypeCodeMeaning
00Echo Reply (ping response)
30Destination Network Unreachable
31Destination Host Unreachable
80Echo Request (ping)
110TTL Expired

Q: How does NAT help with security?

A: Devices behind NAT have private IPs that are not directly reachable from the internet. An external attacker cannot initiate a connection to a NAT’d device — only responses to outbound requests are forwarded.

Q: What’s the difference between Ping and Traceroute?

A: Ping checks reachability by measuring RTT to a destination (ICMP Echo). Traceroute reveals the entire path by exploiting TTL — each router sends back ICMP Time Exceeded, one hop at a time.

Q: Does ICMP use TCP or UDP?

A: Neither. ICMP is a standalone Layer 3 protocol that sits directly on top of IP. It has its own protocol number (1).

Q: What is the difference between SNAT and DNAT?

A: SNAT (Source NAT) changes the source IP of outgoing packets — used for outbound internet access. DNAT (Destination NAT) changes the destination IP of incoming packets — used for port forwarding (e.g., exposing a web server behind NAT).

My Private Notes

Notes are auto-saved locally to this device.