Core Computer Networking Concepts and Protocols Overview

Network Architecture Models

Computer networking architectures are typically standardized using layered models. The Open Systems Interconnection (OSI) model defines seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. The TCP/IP model condenses these into four layers: Network Interface, Internet, Transport, and Application. In practical academic and engineering contexts, a hybrid five-layer model is often used: Physical, Data Link, Network, Transport, and Application.

  • Physical Layer: Transmits raw bit streams over a physical medium. Protocols include Ethernet standards (IEEE 802.3). Devices include hubs and repeaters.
  • Data Link Layer: Encapsulates packets into frames, handles MAC addressing, and performs error detection. Protocols include PPP, MAC, and ARP. Switches operate at this layer.
  • Network Layer: Manages logical addressing (IP) and routing. Key protocols are IP, ICMP, and OSPF. Routers operate here.
  • Transport Layer: Provides end-to-end communication services between processes. Core protocols are TCP and UDP.
  • Application Layer: Interfaces directly with user applications. Protocols include HTTP, DNS, FTP, and SMTP.

TCP Connection Management

Transmission Control Protocol (TCP) is a connection-oriented protocol requiring a handshake to establish and a wave to terminate connections.

Three-Way Handshake

To synchronize sequence numbers and establish a connection:

  1. SYN: The client sends a packet with the SYN flag set and a random sequence number x.
  2. SYN-ACK: The server receives the SYN, allocates resources, and responds with a packet containing SYN flag=1, ACK flag=1, acknowledgment number x+1, and its own random sequence number y.
  3. ACK: The client receives the SYN-ACK, allocates resources, and sends an ACK packet with acknowledgment number y+1 and sequence number x+1.
This process ensures both sides are ready and prevents stale connection requests from consuming server resources.

Four-Way Wave

To terminate a full-duplex connection:

  1. FIN: The active closer sends a FIN packet, indicating no more data will be sent.
  2. ACK: The passive closer acknowledges the FIN. The connection is now half-closed.
  3. FIN: The passive closer sends its own FIN packet when ready to close.
  4. ACK: The active closer acknowledges the final FIN.
The active closer enters a TIME-WAIT state for 2MSL (Maximum Segment Lifetime) to ensure the final ACK reaches the peer and to allow any delayed packets in the network to dissipate.

TCP vs. UDP

TCP (Transmission Control Protocol) is connection-oriented, reliable, and ordered. It features flow control (sliding windows), congestion control, and error recovery via retransmissions. It is suitable for file transfers, emails, and web browsing.

UDP (User Datagram Protocol) is connectionless and unreliable. It does not guarantee order or delivery but offers lower latency. It is ideal for real-time applications like video streaming, VoIP, and DNS queries where speed is prioritized over accuracy.

TCP Reliability and Congestion Control

TCP ensures reliability through checksums, sequence numbers, cumulative acknowledgments (ACKs), and retransmissions triggered by timeouts or duplicate ACKs.

Congestion Control algorithms manage network traffic load:

  • Slow Start: The congestion window (cwnd) grows exponentially until a threshold is reached.
  • Congestion Avoidance: cwnd grows linearly to probe for available bandwidth.
  • Fast Retransmit: Upon receiving three duplicate ACKs, the sender retransmits the lost segment immediately without waiting for a timeout.
  • Fast Recovery: After fast retransmit, cwnd is reduced (multiplicative decrease) and then enters congestion avoidance, skipping the slow start phase.

HTTP Protocol Fundamentals

Status Codes

  • 2xx (Success): 200 OK (Request succeeded).
  • 3xx (Redirection): 301 Moved Permanently, 304 Not Modified.
  • 4xx (Client Error): 400 Bad Request, 403 Forbidden, 404 Not Found.
  • 5xx (Server Error): 500 Internal Server Error, 502 Bad Gateway.

Request Methods

  • GET: Retrieves data. Parameters are in the URL. Idempotent and cacheable.
  • POST: Submits data to be processed. Parameters are in the body. Not idempotent.
  • HEAD: Retrieves headers only.
  • PUT & DELETE: Used for updating and removing resources respectively.

HTTP Versions

HTTP/1.0 uses non-persistent connections (one request per TCP connection). HTTP/1.1 introduced persistent connections (Keep-Alive), chunked transfer encoding, and host headers for virtual hosting. HTTP/2.0 introduced binary framing, multiplexing (multiple requests over one TCP connection), header compression (HPACK), and server push.

HTTPS and Security

HTTPS (HTTP Secure) uses SSL/TLS to encrypt HTTP traffic. It runs on port 443. The key difference from HTTP is the use of encryption to ensure data integrity and confidentiality.

Key Exchange Process

HTTPS uses a hybrid encryption system:

  1. The client requests a secure connection.
  2. The server sends its digital certificate containing its Public Key.
  3. The client verifies the certificate and generates a random Session Key (symmetric key).
  4. The client encrypts the Session Key using the Server's Public Key and sends it back.
  5. The server decrypts the Session Key using its Private Key.
  6. Subsequent data is encrypted using the symmetric Session Key for performance.

HTTP Caching

Client-Side Caching:

  • Strong Cache: Controlled by Expires or Cache-Control: max-age. The browser uses the cached resource without contacting the server.
  • Negotiation Cache (Validation): Used when the strong cache expires. The client sends headers like If-None-Match (Etag) or If-Modified-Since. If the content is unchanged, the server returns 304 Not Modified.

From URL to Page Render

  1. DNS Resolution: Convert domain name to IP address.
  2. TCP Handshake: Establish connection to the server IP.
  3. HTTP Request: Browser sends request headers.
  4. Server Processing: Server handles request and sends response (HTML, CSS, JS).
  5. Browser Rendering: Parse HTML to DOM, Parse CSS to CSSOM, build Render Tree, Layout (reflow), and Paint.

Cookies and Sessions

Cookies are stored on the client and sent with every HTTP request. Sessions are stored on the server. A Session ID is typically stored in a cookie to link the two. If cookies are disabled, session tracking can be achieved via URL Rewriting (appending ;jsessionid=... to the URL).

Tags: networking TCP/IP HTTP HTTPS Cybersecurity

Posted on Fri, 07 Aug 2026 16:37:12 +0000 by dyluck