IPv4 in Practice: The Life of a Packet

In this lesson, we'll consolidate everything we have learned about the network layer so far by tracing the journey of a packet.

At this point in the description of IPv4, it is useful to have a detailed look at how an IPv4 implementation sends, receives and forwards IPv4 packets.

The simplest case is when a host needs to send a transport layer segment in an IPv4 packet. In order to do so, it performs two operations.

  1. First, it must decide on which interface the packet will be sent.

  2. Second, it must create the corresponding IP packet(s).

To simplify the discussion in this section, we ignore the utilization of IPv4 options. This is not a bad idea as most of the traffic today consists of IP packets that don’t make any use of IP options. Furthermore, we also assume that only point-to-point links are used.

An IPv4 host with nn data link layer interfaces manage n+1n+1 IPv4 addresses:

  • The 127.0.0.1/32127.0.0.1/32 IPv4 address assigned by convention to its loopback address.

  • One A.B.C.D/pA.B.C.D/p IPv4 address assigned to each of its nn data link layer interfaces.

  • The host maintains a forwarding table that contains one entry for its loopback address and one entry for each subnet identifier assigned to its interfaces.

  • Furthermore, the host usually uses one of its interfaces as the default interface when sending packets that are not addressed to a directly connected destination. This is represented by the default route: 0.0.0.0/0 that is associated with one interface.

Get hands-on with 1200+ tech skills courses.