Computer Networks

IP

The internet's network protocol: best-effort datagrams and hierarchical addresses.

Level: beginner

What is it?

Internet Protocol (IP) delivers packets across interconnected networks using logical addresses and routing. IP is connectionless and best-effort: it does not promise that each packet arrives, arrives once, or arrives in order.

Why does it matter?

IP provides a common layer across different link technologies. Reliability, ordering, congestion behavior, and application-level semantics are supplied by other protocols when needed.

Mental model

Think of IP as a postal addressing and forwarding system. Each router forwards a packet closer to the destination based on a routing table; intermediate routers do not establish a reliable end-to-end conversation by themselves.

How it works

  • IPv4 uses 32-bit addresses and IPv6 uses 128-bit addresses.
  • Routers forward based on destination prefixes and next-hop decisions.
  • TTL in IPv4 (Hop Limit in IPv6) limits packets from circulating indefinitely.
  • IP may fragment or require packetization choices depending on version and path MTU; IPv6 routers do not fragment packets in transit.
  • TCP, UDP, and application logic provide behavior beyond IP's best-effort delivery contract.

Steps

  • A host creates an IP packet for a destination address.
  • It checks whether the destination is local or needs a configured gateway.
  • The packet is wrapped in the local link's frame and sent to the next hop.
  • Each router consults its forwarding table and transmits the packet on a new link until it reaches the destination network.

Real-world usage

  • Reading packet captures and routing tables.
  • Explaining how traffic crosses multiple networks.
  • Distinguishing link-layer delivery from end-to-end IP routing.

Common mistakes

  • Assuming IP guarantees delivery or in-order arrival.
  • Assuming the destination IP is necessarily a device's hardware address.
  • Treating all addresses in the same subnet prefix as directly reachable without considering routing and policy.

Interview questions

What service does IP provide?

Best-effort packet delivery across networks using logical addresses and routing, without an end-to-end delivery guarantee.

Why is a default gateway needed?

It provides the next hop for destinations not covered by the host's directly connected routes.

Prerequisites

Related concepts

Continue learning

Browse the full computer science library