Networking Workflow
** OSI Model vs. TCP/IP Model**¶

-
OSI Model:
- A seven-layer reference model for system communication.
- Defines clear separation of tasks per layer.
- Standardized by ITU and ISO, often called the ISO/OSI model.
-
TCP/IP Model:
-
A protocol family essential for Internet communication.
- Includes TCP, IP, ICMP, and UDP for data transport and switching.
- More practical and widely used compared to the OSI model.
** Packet Transfers**¶
-
In a layered network system, data is transferred as Protocol Data Units (PDU) at each layer.
- When requesting a website, data moves down the OSI layers, each performing specific functions, until it reaches the physical layer for transmission.
- The destination device receives the data and processes it up the layers until the application uses it.

Encapsulation and Decapsulation¶
- Encapsulation: Each OSI layer adds a header to the data from the upper layer to control and identify packets.
- The PDU (Protocol Data Unit) is passed down the layers until it reaches the Physical or Network Layer for transmission.
- Decapsulation: The receiver removes headers at each layer, using the information to process and deliver the data to the application.
- This cycle continues until all data is successfully sent and received.
** Importance of OSI and TCP/IP Models for Penetration Testers**¶
- TCP/IP Model: Helps quickly understand how a connection is established.
- OSI Model: Allows detailed analysis by breaking down network traffic layer by layer.
- Use Case: Penetration testers often intercept and analyze network traffic, requiring deep knowledge of both models.
- Recommendation: Master both models to effectively perform network traffic analysis.
OSI Model and Its Role in Communication¶
- Purpose: The OSI model standardizes communication across different systems using seven hierarchical layers
| Layer | Function |
|---|---|
| 7. Application | Manages data input/output and provides application functions. |
| 6. Presentation | Converts system-dependent data formats into an application-independent format. |
| 5. Session | Controls logical connections and maintains sessions between systems. |
| 4. Transport | Ensures reliable end-to-end communication, error detection, and flow control. |
| 3. Network | Handles routing, forwarding, and addressing of data packets across networks. |
| 2. Data Link | Ensures reliable, error-free transmission and organizes data into frames. |
| 1. Physical | Transmits raw data via electrical, optical, or wireless signals. |
| - Communication Process: Data travels downward (sender) and upward (receiver) through the layers, ensuring security, reliability, and performance in communication. |
** TCP/IP Model and Its Functions**¶
-
Purpose: The TCP/IP model, also called the Internet Protocol Suite, standardizes communication across networks. It consists of four layers, each responsible for different aspects of networking.
-
Layer Functions:
| TCP/IP Model | Function | Corresponding OSI Layers |
|---|---|---|
| Application (Layer 4) | Defines communication protocols for applications (e.g., HTTP, FTP, SMTP, DNS) | Application (7), Presentation (6), Session (5) |
| Transport (Layer 3) | Manages data flow with TCP (reliable) and UDP (fast but unreliable) | Transport (4) |
| Internet (Layer 2) | Handles IP addressing, routing, and packet forwarding | Network (3) |
| Link (Layer 1) | Manages physical data transmission over the network medium | Data Link (2), Physical (1) |
-
Comparison with OSI:
- The TCP/IP model has fewer layers but serves the same purpose as the OSI model.
- TCP (Layer 4 in OSI) and IP (Layer 3 in OSI) are central protocols in networking.
Here’s a structured table for TCP/IP tasks and their corresponding protocols
| Task | Protocol | Description |
|---|---|---|
| Logical Addressing | IP | Assigns logical addresses to nodes in a network, using network classes, subnetting, and CIDR to structure topology. |
| Routing | IP | Determines the next hop for each data packet to reach its destination efficiently. |
| Error & Control Flow | TCP | Maintains a virtual connection between sender and receiver with control messages to ensure connection reliability. |
| Application Support | TCP/UDP | Uses port numbers to differentiate applications and manage their communication. |
| Name Resolution | DNS | Resolves human-readable domain names (FQDNs) into IP addresses for internet communication. |