Internet Backend 02 ๐ The TCP/IP Protocol Suite
The TCP/IP protocol suite is the implementation that the Internet actually runs on. It is not a single protocol but a family of protocols that work together across four layers: the Network Access layer, the Internet layer, the Transport layer, and the Application layer. The OSI model has seven layers and is a conceptual reference; the TCP/IP model has four and is the working implementation . The mapping is not exact. The OSI Physical and Data Link layers collapse into the TCP/IP Network Access layer, the OSI Network layer becomes the TCP/IP Internet layer, the OSI Transport layer is preserved, and the OSI Session, Presentation, and Application layers are folded into the TCP/IP Application layer.
The suite is defined by the protocols at each layer. The Internet layer is IP, with ICMP and ARP as its companions. The Transport layer is TCP and UDP. The Application layer is HTTP, DNS, DHCP, SMTP, and the rest. The Network Access layer is the link technology: Ethernet, Wi-Fi, and the drivers that move the frames. The protocols are the contract, and the contract is what makes the Internet work across vendors, operating systems, and link technologies.
Key point: TCP/IP has four layers: Network Access, Internet, Transport, and Application. IP provides the connectionless, best-effort packet delivery. TCP provides the reliable, ordered byte stream. UDP provides the connectionless, unreliable datagram service. ARP maps IP addresses to MAC addresses, ICMP reports errors and diagnostics, DNS resolves names to addresses, and DHCP configures hosts automatically.
Why the TCP/IP suite is the implementation
The design philosophy. The OSI model was designed by a committee, top-down, with the layers defined before the protocols. TCP/IP was built by researchers, bottom-up, with the protocols implemented and the layers described afterward . The result is a suite that is pragmatic rather than elegant. The protocols were designed to solve specific problems, and the layering was the description of what emerged, not the constraint that shaped it. The pragmatism is the reason the suite won: it was implemented, it worked, and it scaled.
The hourglass model. The TCP/IP suite is often drawn as an hourglass. The wide top is the Application layer, with many protocols. The narrow waist is the Internet layer, with IP as the single protocol. The wide bottom is the Network Access layer, with many link technologies. The narrow waist is the design decision that makes the Internet work: IP is the common language that every link technology must speak, and every application can use. A new link technology only needs an IP driver; a new application only needs to use IP. The hourglass is the reason the Internet can evolve at the edges without changing the center.
The end-to-end principle. The TCP/IP suite follows the end-to-end principle: the network’s job is to move packets, and the intelligence belongs at the endpoints. The routers do not track connections, do not guarantee delivery, and do not know what the packets contain. The reliability, the ordering, and the congestion control are the endpoints’ responsibility. The principle is why TCP can provide a reliable stream over an unreliable network, and why UDP can provide a low-latency datagram service without the network’s interference.
The trade-off. The TCP/IP suite is not a perfect implementation of the OSI model, and the differences matter. The Session and Presentation layers do not exist as separate layers, so the session management is the application’s job (cookies, tokens) and the encryption is the library’s job (TLS). The Network Access layer combines the Physical and Data Link layers, so the link technology and the framing are treated as a single concern. The trade-off is the simplicity of the four-layer model against the precision of the seven-layer model. The four-layer model is what the Internet uses; the seven-layer model is what the engineers use to describe it.
a. The Internet layer: IP, ICMP, and ARP
The Internet layer is the narrow waist. Its primary protocol is IP, which provides the connectionless, best-effort packet delivery. The IP packet contains the source and destination IP addresses, the TTL, the protocol number, and the payload. The IP layer does not guarantee the delivery, does not order the packets, and does not detect the errors in the payload. It only routes the packet from the source to the destination, one hop at a time, using the routing table . The TTL is decremented by every router, and the packet is dropped when the TTL reaches zero, which is the mechanism that prevents the routing loops.
The IP header is 20 bytes minimum. The version is 4 for IPv4. The IHL is the header length. The total length is the packet length. The identification, the flags, and the fragment offset are the fields for the fragmentation. The TTL is the hop counter. The protocol field is the number that identifies the Transport layer protocol: 6 is TCP, 17 is UDP, and 1 is ICMP. The source and destination IP addresses are the logical addresses.
ICMP is the companion protocol. It reports the errors and the diagnostic information. The ping command uses the ICMP Echo Request and Echo Reply messages. The traceroute command uses the ICMP Time Exceeded messages, which are generated when the TTL reaches zero. The Destination Unreachable message is generated when the packet cannot be delivered. ICMP is not a Transport layer protocol; it is a Network layer protocol that carries the control information for IP .
ARP is the address resolution protocol. It maps the IP address to the MAC address on the local network. When a host needs to send a packet to an IP address on the same subnet, it needs the MAC address of the destination. It broadcasts an ARP request: “Who has IP address 192.168.1.1? Tell 192.168.1.5.” The owner of the IP address replies with its MAC address, and the sender caches the mapping in its ARP table . The ARP is the bridge between the Internet layer and the Network Access layer. Without it, the IP packet cannot be encapsulated in the Ethernet frame.
The ARP request:
Who has 192.168.1.1? Tell 192.168.1.5
The ARP reply:
192.168.1.1 is at 00:26:15:55:5a:c6
The ARP is a local protocol. It does not cross the router boundaries. When a host sends a packet to a different subnet, it uses the MAC address of the default gateway, not the MAC address of the final destination. The router receives the frame, decapsulates the IP packet, looks up the destination in its routing table, and forwards the packet to the next hop. The ARP is used at each hop to resolve the next hop’s MAC address.
b. The Transport layer: TCP and UDP
The Transport layer is the end-to-end communication between the processes. The two protocols are TCP and UDP, and they make opposite trade-offs.
TCP is the reliable, ordered, connection-oriented protocol. It provides a stream-of-bytes service: the application writes bytes, and TCP delivers them in order, without loss, without duplication . The reliability is implemented with the sequence numbers, the acknowledgments, and the retransmissions. The sequence number identifies the position of the byte in the stream. The acknowledgment number confirms the receipt. The timeout and the retransmission recover the lost packets. The connection is established with the three-way handshake (SYN, SYN-ACK, ACK) and terminated with the four-way handshake (FIN, ACK, FIN, ACK). The flow control is the sliding window, which prevents the sender from overwhelming the receiver. The congestion control is the mechanism that adapts the sending rate to the network capacity .
The TCP three-way handshake:
Client โ Server: SYN (seq=x)
Server โ Client: SYN-ACK (seq=y, ack=x+1)
Client โ Server: ACK (ack=y+1)
The TCP header is 20 bytes minimum. The source and destination ports identify the applications. The sequence and acknowledgment numbers implement the reliability. The flags (SYN, ACK, FIN, RST, PSH, URG) control the connection. The window size implements the flow control. The checksum detects the errors in the header and the payload.
UDP is the connectionless, unreliable datagram protocol. It provides a datagram service: the application sends a message, and UDP delivers it if it can, without the handshake, without the acknowledgment, and without the retransmission . The UDP header is only 8 bytes: the source port, the destination port, the length, and the checksum. The checksum is optional in IPv4 and mandatory in IPv6 . The UDP is the choice for the applications that prefer the low latency over the reliability: the DNS queries, the DHCP, the VoIP, the streaming video, and the online games .
The UDP datagram:
[Source Port (16 bits)][Destination Port (16 bits)]
[Length (16 bits)][Checksum (16 bits)]
[Data]
The UDP is the right choice when the retransmission would be counterproductive. A VoIP packet that arrives late is useless; the retransmission would arrive even later. A video frame that is lost can be skipped; the retransmission would stall the stream. The UDP is also the right choice when the application implements its own reliability, such as the QUIC protocol, which runs over UDP and implements the streams, the congestion control, and the encryption in the user space .
Complete Example Session
// ============================================
// PART 1: THE IP LAYER
// ============================================
// The IP packet is the unit of the Internet layer.
// It contains the source and destination IP addresses.
// The TTL is decremented by every router.
// The protocol field identifies the Transport layer protocol.
// 6 = TCP, 17 = UDP, 1 = ICMP.
// ============================================
// PART 2: THE ICMP
// ============================================
// The ping command sends the ICMP Echo Request.
// The reply is the ICMP Echo Reply.
// The traceroute uses the ICMP Time Exceeded.
// The Destination Unreachable reports the delivery problems.
// ============================================
// PART 3: THE ARP
// ============================================
// The ARP maps the IP address to the MAC address.
// The request is broadcast: "Who has 192.168.1.1?"
// The reply is unicast: "192.168.1.1 is at 00:26:15:55:5a:c6."
// The ARP is local; it does not cross the routers.
// ============================================
// PART 4: THE TCP
// ============================================
// The TCP is the reliable, ordered, connection-oriented protocol.
// The three-way handshake establishes the connection.
// The sequence numbers order the bytes.
// The acknowledgments confirm the receipt.
// The retransmissions recover the lost packets.
// The sliding window controls the flow.
// The congestion control adapts to the network.
// ============================================
// PART 5: THE UDP
// ============================================
// The UDP is the connectionless, unreliable datagram protocol.
// The header is 8 bytes.
// The checksum is optional in IPv4, mandatory in IPv6.
// The UDP is for the DNS, DHCP, VoIP, streaming, gaming.
// ============================================
// PART 6: THE TCP VS UDP
// ============================================
// TCP: reliable, ordered, connection-oriented, flow control, congestion control.
// UDP: unreliable, unordered, connectionless, no flow control, no congestion control.
// TCP: the web, the email, the file transfer, the SSH.
// UDP: the DNS, the DHCP, the VoIP, the streaming, the gaming.
// ============================================
// PART 7: THE APPLICATION LAYER
// ============================================
// HTTP: the web.
// DNS: the name resolution.
// DHCP: the automatic host configuration.
// SMTP: the email.
// FTP: the file transfer.
// SSH: the secure remote shell.
// ============================================
// PART 8: THE PORT NUMBERS
// ============================================
// 20/21: FTP
// 22: SSH
// 25: SMTP
// 53: DNS (UDP for queries, TCP for zone transfer)
// 67/68: DHCP
// 80: HTTP
// 123: NTP
// 443: HTTPS
// ============================================
// PART 9: THE DHCP
// ============================================
// The DHCP configures the host automatically.
// The client broadcasts the DHCP Discover.
// The server offers the IP address.
// The client requests the offered IP.
// The server acknowledges the assignment.
// The DHCP provides the IP, the subnet mask, the gateway, the DNS.
// ============================================
// PART 10: THE CHECKLIST
// ============================================
// [ ] The IP is the Internet layer protocol.
// [ ] The ICMP is the error and diagnostic protocol.
// [ ] The ARP maps the IP to the MAC.
// [ ] The TCP is the reliable transport.
// [ ] The UDP is the unreliable transport.
// [ ] The DNS is the name resolution.
// [ ] The DHCP is the automatic configuration.
// [ ] The port numbers identify the applications.
The ten parts covered the Internet layer, the ICMP, the ARP, the TCP, the UDP, the TCP vs UDP, the Application layer, the port numbers, the DHCP, and the checklist. The through-line is that the suite is the implementation, and the protocols are the contract.
Quick Reference
The four layers
| Layer | Protocols | Purpose |
|---|---|---|
| Application | HTTP, DNS, DHCP, SMTP, FTP | The network services |
| Transport | TCP, UDP | The end-to-end communication |
| Internet | IP, ICMP, ARP | The logical addressing and routing |
| Network Access | Ethernet, Wi-Fi | The link and the physical |
The TCP vs UDP
| Aspect | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Reliable | Unreliable |
| Ordering | Ordered | Unordered |
| Header | 20 bytes minimum | 8 bytes |
| Flow control | Yes | No |
| Congestion control | Yes | No |
| Use cases | Web, email, SSH | DNS, DHCP, VoIP, streaming |
The port numbers
| Port | Protocol | Service |
|---|---|---|
| 20/21 | TCP | FTP |
| 22 | TCP | SSH |
| 25 | TCP | SMTP |
| 53 | UDP/TCP | DNS |
| 67/68 | UDP | DHCP |
| 80 | TCP | HTTP |
| 123 | UDP | NTP |
| 443 | TCP | HTTPS |
The ICMP types
| Type | Name | Use |
|---|---|---|
| 0 | Echo Reply | The ping response |
| 3 | Destination Unreachable | The delivery failure |
| 8 | Echo Request | The ping request |
| 11 | Time Exceeded | The traceroute |
Best Practices
โ Do This:
// Use TCP for the reliable, ordered communication
// The web, the email, the file transfer, the SSH.
// Use UDP for the low-latency communication
// The DNS, the DHCP, the VoIP, the streaming, the gaming.
// Use the ARP to resolve the MAC address on the local network.
// Use the ICMP to diagnose the connectivity.
โ Don’t Do This:
// Assume UDP is unreliable by design
// The application can implement its own reliability (QUIC).
// Assume TCP is always faster
// The handshake and the congestion control add the latency.
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| The TCP is slow for the small messages | The three-way handshake and the congestion control | Use UDP or a persistent connection |
| The UDP packet is lost | The UDP does not retransmit | Implement the reliability in the application |
| The DNS is slow | The UDP query is retried | Use the TCP for the large responses or the DoH |
| The ARP is not resolving | The destination is on a different subnet | Use the gateway’s MAC address |
Summary
| Item | Value |
|---|---|
| The suite | Four layers: Network Access, Internet, Transport, Application |
| The Internet layer | IP, ICMP, ARP |
| The Transport layer | TCP, UDP |
| The TCP | Reliable, ordered, connection-oriented |
| The UDP | Unreliable, unordered, connectionless |
| The ARP | IP to MAC resolution |
| The ICMP | Error and diagnostic |
| The DNS | Name resolution |
| The DHCP | Automatic configuration |
Key takeaways:
- TCP/IP is the implementation, and it has four layers. The Network Access layer combines the Physical and Data Link layers, the Internet layer is IP, the Transport layer is TCP and UDP, and the Application layer is HTTP, DNS, DHCP, and the rest . The OSI model is the reference; the TCP/IP model is the reality.
- The IP is the narrow waist. It provides the connectionless, best-effort packet delivery, and it is the common language that every link technology speaks and every application uses. The TTL prevents the routing loops, and the protocol field identifies the Transport layer protocol.
- The TCP is the reliable, ordered, connection-oriented protocol. It provides the stream-of-bytes service with the sequence numbers, the acknowledgments, the retransmissions, the flow control, and the congestion control . The three-way handshake establishes the connection, and the four-way handshake terminates it.
- The UDP is the connectionless, unreliable datagram protocol. The header is 8 bytes, and the checksum is optional in IPv4 and mandatory in IPv6 . The UDP is the choice for the low-latency applications where the retransmission would be counterproductive: the DNS, the DHCP, the VoIP, the streaming, and the gaming .
- The ARP and the ICMP are the companions of IP. The ARP maps the IP address to the MAC address on the local network, and the ICMP reports the errors and the diagnostic information. The
pingand thetracerouteare the ICMP-based tools .
Remember: The TCP/IP suite is the implementation that the Internet runs on. The four layers are the working model, and the protocols at each layer are the contract. The IP is the narrow waist, the TCP is the reliable transport, the UDP is the low-latency transport, the ARP is the address resolution, the ICMP is the error reporting, and the DNS and the DHCP are the configuration protocols. The suite is pragmatic, not elegant, and the pragmatism is why it works.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!