Networking handbook · Chapter 20

TCP/IP model

An application message becomes transport data, an IP packet and then a frame suited to the next link. The Internet architecture organizes these jobs into application, transport, internet and link layers.

In this guide13 sections

Introduction

An application message becomes transport data, an IP packet and then a frame suited to the next link. The Internet architecture organizes these jobs into application, transport, internet and link layers.

Trace encapsulation at a sender

Consider a DNS message sent over UDP. DNS defines the question and answer fields. UDP preserves the message boundary and supplies ports. IP carries the datagram toward the remote address. A link mechanism delivers it to the selected next hop.

Each layer uses a different selector. Ethernet II has an EtherType for the payload protocol. IPv4 has a Protocol field. IPv6 uses Next Header values and can include extension headers. UDP ports help the receiving host select the appropriate endpoint.

Account for what changes at a hop

Ordinary routers consult IP forwarding information and replace the link framing for the next link. They decrement the TTL or Hop Limit. Hosts at the transport endpoints interpret the UDP ports or TCP stream state.

Middleboxes and tunnels can alter this simple picture. A translator may change addresses and ports, and a tunnel adds another outer delivery header. Draw each encapsulation boundary explicitly before attributing a captured address to the application endpoint.

Choose a model that fits the question

The four-layer description in RFC 1122 places link technologies below IP and groups application and support protocols above transport. Some textbooks split the link into data link and physical layers, yielding five layers. Label the convention when discussing a layer number.

The architecture includes more than TCP. UDP is another transport, and IP can also carry control protocols such as ICMP. Applications choose a service based on the semantics they need, including ordering, message boundaries and recovery.

Diagram

  1. DNS message
  2. UDP · client port to 53
  3. IPv4 · client to resolver
  4. Ethernet · host to next hop
At the receiver, the link, IP and UDP headers guide delivery back to the DNS endpoint. The example assumes an ordinary unencrypted DNS query over UDP.

Worked examples

Build one DNS packet from its payload length

  1. Assume the DNS message is 32 bytes. Add an eight-byte UDP header. The UDP length field is 40 bytes.
  2. With an option-free IPv4 header, the IP total length is 20 + 40 = 60 bytes. Set the IPv4 Protocol field to 17 for UDP.
  3. An untagged Ethernet II frame uses EtherType 0x0800 and carries the 60-byte IP packet. Add 14 header bytes and four FCS bytes for a 78-byte MAC frame. No pad is required.

DNS Record Reference: Read a two-stage mail-routing entry

  1. Read “example.org. 3600 IN MX 10 mail.example.org.” as an MX record for example.org. Its preference is 10, its target is mail.example.org., and 3600 seconds equals one hour.
  2. Read “mail.example.org. 300 IN A 192.0.2.25” as a separate IPv4 address record for the target. Its TTL is five minutes.
  3. If a second MX has preference 20, senders normally try the lower preference first. The target name and its address can be updated and cached on different schedules.

Reference table

TCP/IP model reference
Internet model layerTypical examplesItem to document
ApplicationDNS, HTTPMessage format and service identity
TransportUDP, TCPPorts and required delivery behavior
InternetIPv4, IPv6, ICMPAddresses, prefixes and forwarding policy
LinkEthernet, Wi-FiLink technology and next-hop delivery

Configuration example

  • For a DNS client using a remote resolver, document the resolver address and permitted transport alongside the local prefix, gateway and VLAN. Those settings belong to different layers of the same dependency.
  • For packet-size agreements, record whether a limit applies to application data, a whole IP packet or the link frame. Translate between them using the configured IP and transport headers.

Common mistakes

  • Assuming every application using Internet protocols runs over TCP.
  • Applying an Ethernet frame length as the application payload limit without removing the enclosed headers.

Frequently asked questions

Where does DNS belong if it can use both TCP and UDP?

DNS has application-layer message semantics. Lower-layer transport choices can change how those messages are delivered while retaining the same question and answer concepts.

Does the receiver always get the same Ethernet header sent by the original host?

Across routers it typically receives the frame transmitted on the last link. The router on that link has selected the relevant local framing and addresses.

How does the TCP/IP model differ from OSI?

TCP/IP groups networking functions into fewer practical layers, while OSI separates them into seven reference layers. The mapping is useful but not one-to-one for every protocol.

Where do TCP and UDP fit?

They are transport-layer protocols in the TCP/IP model. They provide different services to applications above IP.

Where does Ethernet fit in the TCP/IP model?

Ethernet provides link and physical functions below the internet layer. The common four-layer model groups these into a link or network-access layer.

Does an application always use TCP?

No. Applications can use UDP or other transport mechanisms depending on their requirements. Some application protocols use multiple transports or newer transport designs.

Where do DNS and HTTP fit in the model?

They are application-layer protocols in the common TCP/IP model. They rely on transport and IP services below them, even though their behavior can affect how a connection is perceived.

Is ARP an internet-layer protocol?

ARP resolves IPv4 next-hop addresses to link-layer addresses on a local network. It supports delivery across the link and is commonly associated with the network-access layer in the TCP/IP model.

Does the TCP/IP model require Ethernet?

No. IP can run over many link technologies. Ethernet is common on LANs, but the link layer can use other wired, wireless, or point-to-point systems.

Why do TCP/IP and OSI layer diagrams differ?

They group functions for different purposes. OSI separates seven reference layers; TCP/IP's common model groups the implemented Internet suite into fewer layers.

Where does ICMP fit in the TCP/IP model?

ICMP supports control and error reporting for IP, so it is generally treated with the internet layer. It is not a TCP or UDP port-based application service.

Does IP provide reliable delivery?

No. IP provides best-effort packet delivery. Reliability, ordering, or retransmission must be provided by an upper-layer protocol or application when needed.

What is the link layer responsible for?

It moves frames across one local link and handles that medium's addressing and framing. It does not provide an end-to-end route across the internet.

Is the TCP/IP model only about TCP and IP?

No. It describes the wider Internet protocol suite, including UDP, ICMP, DNS, HTTP, Ethernet, Wi-Fi, and many other protocols.

Does a TCP/IP layer map exactly to one OSI layer?

No. The common models group responsibilities differently. A mapping is an explanatory approximation, not a protocol conversion rule.

Further learning and references