Modern computer networks rely on application-layer protocols to facilitate file sharing, system configuration, remote control, and email communications across diverse operating system platforms. This guide details the architecture, design patterns, and operational mechanics of these core Internet protocols.
The exchange of files between heterogeneous computing platforms presents significant challenges, such as reconciling incompatible directory structures, file-naming conventions, and internal data representations (e.g., ASCII versus EBCDIC).
Unlike protocols that multiplex commands and data over a single stream, the File Transfer Protocol (FTP) utilizes an out-of-band control architecture. FTP establishes two separate Transmission Control Protocol (TCP) connections between the client and server:
+---------------------------------------------+
| FTP CLIENT |
| +-----------------+ +-----------------+ |
| | User Interface | | User-PI * | |
| +--------+--------+ +--------+--------+ |
| | | |
| +--------v--------+ +--------v--------+ |
| | Client-DTI* | | Control Conn. | |
| +--------+--------+ +--------+--------+ |
+-----------|---------------------|-----------+
| |
Port 20 (Data) Port 21 (Control)
| |
+-----------|---------------------|-----------+
| | | |
| +--------v--------+ +--------v--------+ |
| | Server-DTI* | | Server-PI* | |
| +--------+--------+ +--------+--------+ |
| | | |
| +--------v--------+ | |
| | File System | | |
| +-----------------+ | |
| FTP SERVER |
+---------------------------------------------+
* PI = Protocol Interpreter | DTI = Data Transfer InterfaceThis separation ensures that a massive file transfer does not block or delay the execution of urgent control commands, such as aborting an active transfer.
The mechanics of data connection establishment depend on the operational mode:
PORT command specifying its temporary IP address and port number. The server then initiates a TCP connection from its local Port 20 to the client's specified port. This mode often fails when the client is behind a firewall or network address translator (NAT), as incoming connection requests are typically blocked.PASV command to the server. The server responds with a temporary port number. The client then initiates the data connection to this port, avoiding firewall blockage.For lightweight file transfers—such as downloading boot images or configuration files to diskless workstations and routers—the overhead of FTP's TCP connections is inefficient. Trivial File Transfer Protocol (TFTP) operates directly over User Datagram Protocol (UDP) on port 69.
+------------------+------------------+------------------+
| Opcode (2 bytes) | Filename (Var) | Mode (Var) | 0 | Read (RRQ) / Write (WRQ)
+------------------+------------------+------------------+
| Opcode (2 bytes) | Block # (2 bytes)| Data (0-512 bytes) | DATA Packet
+------------------+------------------+------------------+
| Opcode (2 bytes) | Block # (2 bytes)| ACK Packet
+------------------+------------------+------------------+To maintain reliability over UDP, TFTP uses a lock-step Stop-and-Wait flow control mechanism:
Remote login protocols allow a user to access a command-line interface on a remote server as if their terminal were physically connected to that system.
+---------------+ NVT Stream +---------------+
| Local Terminal| <----------------------------------------> | Remote Server |
+-------+-------+ +-------+-------+
| |
v v
+---------------+ TCP Connection +---------------+
| TELNET Client | <========================================> | TELNET Server |
+---------------+ Port 23 +---------------+TELNET (Terminal Network) provides terminal emulation across diverse environments using a software abstraction called the Network Virtual Terminal (NVT).
0xFF ().TELNET uses four command codes to dynamically negotiate features like terminal echo, window size, and character set:
| Command Code | Meaning | | :--- | :--- | | DO | Requests that the receiver enable an option, or confirms that the sender expects the receiver to enable it. | | DONT | Demands that the receiver disable an option, or confirms that the sender expects the option to be disabled. | | WILL | Indicates the sender's desire to enable an option, or confirms that the sender has enabled it. | | WONT | Indicates the sender's refusal to enable or continue using an option. |
An example exchange requesting the remote server to handle echo functions is shown below:
Client Server
| |
| -------- [IAC] [DO] [ECHO] (0xFF 0xFD 0x01) ---------> | (Client requests Server to echo)
| |
| <------- [IAC] [WILL] [ECHO] (0xFF 0xFB 0x01) -------- | (Server accepts and starts echoing)TELNET transmits data—including usernames, passwords, and commands—in plaintext, making it vulnerable to eavesdropping and session hijacking. Secure Shell (SSH) provides a secure alternative by establishing an encrypted channel over TCP port 22.
+-----------------------------------------------------------+
| SSH PACKET FORMAT |
| +-----------------------------------------------------+ |
| | Packet Length (4 bytes) | |
| +-----------------------------------------------------+ |
| | Padding Length (1 byte) | |
| +-----------------------------------------------------+ |
| | Payload | |
| | (Authenticated and Encrypted Application Data) | |
| +-----------------------------------------------------+ |
| | Random Padding | |
| +-----------------------------------------------------+ |
| | Message Authentication Code (MAC) | |
| +-----------------------------------------------------+ |
+-----------------------------------------------------------+SSH consists of three main sub-protocols:
The World Wide Web (WWW) is a distributed client-server application that retrieves linked hypermedia resources.
Static Document Retrieval CGI Dynamic Document Generation
Client Server Client Server
| | | |
| --- HTTP GET Request ---> | | --- HTTP GET Request ---> |
| | | | +------------------+
| | [Reads from Disk] | | | Execute Program |
| | | | | & Return Output |
| | | | +--------+---------+
| <--- HTTP 200 OK File --- | | <--- HTTP 200 OK Output - | <--------+HTTP is a stateless protocol used to retrieve resources on the web, operating over TCP port 80.
An HTTP transaction consists of a request and a response.
HTTP Request Message:
+-------------------------------------------------------------+
| Method (e.g., GET) | Space | URL | Space | Version | CR LF | <- Request Line
+-------------------------------------------------------------+
| Header Field Name | : | Value | CR LF | <- Headers
+-------------------------------------------------------------+
| CR LF (Blank Line) |
+-------------------------------------------------------------+
| Entity Body (Optional, e.g., POST payload) |
+-------------------------------------------------------------+
HTTP Response Message:
+-------------------------------------------------------------+
| Version | Space | Status Code (e.g., 200) | Phrase | CR LF | <- Status Line
+-------------------------------------------------------------+
| Header Field Name | : | Value | CR LF | <- Headers
+-------------------------------------------------------------+
| CR LF (Blank Line) |
+-------------------------------------------------------------+
| Entity Body (Optional, e.g., HTML File) |
+-------------------------------------------------------------+The following is an example HTTP request and response trace:
# Client Request
GET /usr/bin/image1.gif HTTP/1.1
Host: www.example.com
Accept: image/gif, image/jpeg
Connection: close
# Server Response
HTTP/1.1 200 OK
Date: Mon, 15 Jul 2026 12:00:00 GMT
Server: Apache/2.4.41 (Unix)
Content-Type: image/gif
Content-Length: 2048
[Raw Binary Image Data]The persistence model of the underlying TCP connection significantly impacts performance:
Non-Persistent Connections (HTTP/1.0): The server opens a new TCP connection for each requested object and closes it immediately after delivery. If an HTML document contains references to ten images, retrieving the page requires eleven separate TCP handshakes:
Persistent Connections (HTTP/1.1): The server keeps the TCP connection open after sending a response. The client can request subsequent objects over the same connection, reducing handshake overhead and latency.
HTTP is stateless; it does not retain information about previous requests. To maintain state (such as user sessions or shopping carts), servers use Cookies:
Set-Cookie header in an HTTP response (e.g., Set-Cookie: ID=12343).Cookie header of all subsequent requests to that domain (e.g., Cookie: ID=12343).Internet email architecture divides the message delivery process into creation, transfer, and retrieval.
Sender Client Mail Servers Receiver Client
+---------------+ SMTP (Push) +-------------+ SMTP (Push) +-------------+
| User Agent | --------------> | Message | --------------> | Message |
| (UA) | | Transfer | | Access |
+---------------+ | Agent (MTA) | | Agent (MAA) |
+-------------+ +------+------+
|
| POP3 / IMAP4
| (Pull)
v
+-------------+
| User Agent |
| (UA) |
+-------------+SMTP operates over TCP port 25 and uses standard ASCII text commands:
Server Response: 220 mail.destination.com ESMTP
Client Command : HELO mail.sender.com
Server Response: 250 OK
Client Command : MAIL FROM:<alice@sender.com>
Server Response: 250 OK
Client Command : RCPT TO:<bob@destination.com>
Server Response: 250 OK
Client Command : DATA
Server Response: 354 Start mail input; end with <CR><LF>.<CR><LF>
Client Command : Subject: Academic Overview
Client Command :
Client Command : This is a test email message.
Client Command : .
Server Response: 250 OK Message accepted for delivery
Client Command : QUIT
Server Response: 221 Service closing transmission channelSMTP was originally designed to transmit only 7-bit US-ASCII text characters. Multipurpose Internet Mail Extensions (MIME) is an expansion framework that allows non-ASCII data, such as images, audio, and attachments, to be sent through standard email.
+--------------------------------------------------------+
| MIME HEADER |
| +--------------------------------------------------+ |
| | MIME-Version: 1.0 | |
| +--------------------------------------------------+ |
| | Content-Type: image/jpeg | |
| +--------------------------------------------------+ |
| | Content-Transfer-Encoding: base64 | |
| +--------------------------------------------------+ |
+--------------------------------------------------------+MIME introduces specialized headers to describe the format of a message payload:
MIME-Version: Declares the version of the MIME standard being used.Content-Type: Defines the media type and subtype of the data (e.g., text/html, image/png, application/pdf).Content-Transfer-Encoding: Specifies the algorithm used to encode binary data into a 7-bit ASCII representation. Common encoding schemes include:
Base64: Divides every bytes of binary data ( bits) into chunks of bits each. Each 6-bit chunk maps to a specific character in a 64-character ASCII table, resulting in a constant size increase of approximately :
IP routing protocols require numeric IP addresses, while users rely on human-readable domain names. The Domain Name System and Dynamic Host Configuration Protocol bridge this gap.
DNS Tree Hierarchy
[Root]
|
+---------------+---------------+
| |
[com] [org]
| |
+------+------+ +-----+-----+
| | | |
[example] [google] [kophub] [ieee]
|
[www]DNS is a distributed database structured as an inverted hierarchical tree with up to levels (Level representing the Root).
When a client resolver queries a domain name, it uses one of two methods:
Iterative Resolution Path:
Client Local DNS Server Root Server TLD Server (.com) Auth Server
| | | | |
| -- Query ----> | | | |
| | -- Query ---------> | | |
| | <-- Refer to .com - | | |
| | | |
| | -- Query -------------------------------> | |
| | <-- Refer to example.com ----------------- | |
| | |
| | -- Query --------------------------------------------------> |
| | <-- IP Address --------------------------------------------- |
|<-- Response -- | |DNS queries and responses are encapsulated in UDP datagrams on port 53.
TC) in the header.To communicate on a TCP/IP network, a host must be configured with four key pieces of information:
DHCP automates this configuration process, operating over UDP with port 67 for servers and port 68 for clients.
Client (0.0.0.0:68) DHCP Server (Port 67)
| |
| ------ DHCPDISCOVER (UDP Broadcast) ----------------> |
| |
| <----- DHCPOFFER (UDP Broadcast/Unicast) ------------ |
| |
| ------ DHCPREQUEST (UDP Broadcast) -----------------> |
| |
| <----- DHCPACK (UDP Broadcast/Unicast) -------------- |A DHCP client transitions through several states to acquire and renew its IP lease:
[INIT]
|
| Send DHCPDISCOVER
v
[SELECTING] <---+ (If lease expires or NAK received)
| |
| Receive DHCPOFFER, Send DHCPREQUEST
v |
[REQUESTING] ---+
|
| Receive DHCPACK
v
[BOUND] (Active lease)
|
| T1 Timer Expires (50% of lease time) -> Send DHCPREQUEST (Unicast)
v
[RENEWING]
|
+--- Receive DHCPACK ---> [BOUND]
|
| T2 Timer Expires (87.5% of lease time) -> Send DHCPREQUEST (Broadcast)
v
[REBINDING]
|
+--- Receive DHCPACK ---> [BOUND]
|
| Lease Expires / NAK
v
[INIT]Network administrators monitor and configure network devices, such as routers, switches, and servers, using network management systems.
+-----------------------+ SNMP Protocol Commands +-----------------------+
| Manager Station | <========================================================> | Managed Agent |
| | GetRequest / SetRequest / Response | +-----------------+ |
| +-----------------+ | | | MIB-2 | |
| | SMI Data Rules | | <------------------ SNMP Trap (Port 162) ----------------- | | (Data Variables)| |
| +-----------------+ | | +-----------------+ |
+-----------------------+ +-----------------------+Network management relies on three coordinated components:
mib-2 subtree.SMI assigns a unique Object Identifier (OID) to every managed variable. All OIDs monitored by SNMP fall under a standardized global tree hierarchy:
For example, the variable that tracks incoming UDP datagrams (udpInDatagrams) is identified by:
SMI uses Abstract Syntax Notation One (ASN.1) and Basic Encoding Rules (BER) to encode data for transmission across the network. BER encodes data using a three-field format:
+-------------------+---------------------+-------------------------+
| Tag (1 byte) | Length (1 byte) | Value (Variable) |
+-------------------+---------------------+-------------------------+0x02 for INTEGER, 0x04 for OCTET STRING).Example: Encoding the integer value 14
+-------------------+---------------------+-------------------------+
| Tag: 0x02 | Length: 0x01 | Value: 0x0E |
+-------------------+---------------------+-------------------------+SNMP uses UDP port 161 for standard manager-initiated queries and port 162 for agent-initiated event notifications (Traps).
+---------------------------------------------------------------------------------------------------------+
| SNMP PDU FORMAT |
| +------------------+-------------------+-------------------------+----------------------------------+ |
| | PDU Type (1 byte)| Request ID (4 B) | Error Status (1 byte) | Error Index (1 byte) | |
| +------------------+-------------------+-------------------------+----------------------------------+ |
| | VarBind List (Sequence of Object Identifiers and their associated values) | |
| +---------------------------------------------------------------------------------------------------+ |
+---------------------------------------------------------------------------------------------------------+Out-of-band control uses separate channels for control commands and data transfer (e.g., FTP ports 21 and 20), whereas in-band control multiplexes control and data over a single connection (e.g., HTTP port 80).
A universal, software-defined interface used by TELNET to translate diverse local terminal keystrokes and control characters into a standardized format before transmission.
Dynamic documents are generated on-the-fly by the web server (e.g., CGI, PHP) before transmission, whereas active documents are program files (e.g., JavaScript, WebAssembly) sent to and executed directly on the client browser.
Push protocols (e.g., SMTP) actively transmit data from the sender to the receiver, while pull protocols (e.g., POP3, IMAP4, HTTP) request and extract data from a remote server to the client.
The Structure of Management Information (SMI) defines naming rules and data types, the Management Information Base (MIB) lists the variables of a managed device, and the Simple Network Management Protocol (SNMP) coordinates the packet exchange between managers and agents.
Test your understanding with 5 questions
Why does FTP maintain separate TCP connections for control and data, and how do they operate?
In TELNET option negotiation, if a client wants to request that the remote server enable a specific option, which sequence of control characters must be transmitted?
Which of the following describes the conditions under which DNS utilizes TCP instead of UDP?
In a typical modern client-to-client email architecture, what is the sequence of push and pull protocols used across the entire delivery chain?
During a DHCP transaction, why must the initial DHCPDISCOVER and DHCPOFFER messages be encapsulated in UDP datagrams with IP broadcast destinations?
Quoted-Printable: Used when the data is mostly ASCII text with a few non-ASCII characters. Non-ASCII bytes are represented by an equals sign followed by their two-digit hexadecimal value (e.g., =3D).
6 Modules
6 Modules