CCNA Class 02: OSI Reference Model
What is the OSI Model?
The Internetworking Model stands for the Open Systems Interconnection (OSI) reference Model, which is a conceptual framework (blueprint) that divides network communications functions into seven logical layers. It was created by the International Organization for Standardization (ISO) in the 1970s.
Advantages of Reference Models -
The OSI model divides the network communication process into smaller and simpler components, thus aiding component development, design, and troubleshooting.
It allows multiple vendor development through the standardization of network components.
It encourages industry standardization by defining what functions occur at each layer of the model.
It allows various types of network hardware and software to communicate.
It prevents changes in one layer from affecting other layers, so it doesn’t hamper development and makes application programming easier.
The OSI Reference Model has Seven Layers-
Fig 01: OSI Model Architecture
Layer 07: Application Layer, this layer works with protocols such as HTTP, HTTPS, FTP, TFTP, DNS, SMTP, and so on to communicate with the next layers. The Header is DATA.
Layer 06: Presentation Layer, This layer is responsible for Data Encryption, decryption, compression, decompression, and translation are associated to go for the next layers.
Layer 05: Session Layer, While transferring data from source to destination point, it will be responsible for creating a communication session between presentation layer entities.
Layer 04: Transport Layer, responsible for End-to-End communication between the two devices and the datastream breaking it up into segments before sending it to the Next Layer (Network Layer). Using the TCP/UDP protocol.
Layer 03: Network Layer, responsible for logical addressing, routing services, and forwarding data as Packets across different networks. For the same network, interaction is not necessary.
Layer 02: Data Link Layer, responsible for the physical address, handles error notifications (FCS), network topology, and flow control. This layer formats the packet into pieces called data frames and adds a customized header containing the destination and source MAC address.
Layer 01: Physical Layer, Data frame converted into a Bitstream (1 & 0) for transmitting the higher layers.
How Does the OSI Model Work?
Fig: Communication Between Source to Destination PC
Above the Figure, When a user pings to PC1 from PC0, it goes to the application layer first. The application layer will select the right protocol (ICMP) and send it to the presentation layer. The presentation layer compresses the message as Data and sends it to the Session Layer. The session layer will build a communication session between the source to destination PC and send the data to the Transport Layer as segmentation. The segment will be sent to the network layer using the TCP/UDP protocol. The Network layer will be divided into the Packets and go to the Data Link Layer and reform as Frame. Finally, It will go to the Physical Layer from the Data Link Layer as a Bitstream.
Connection-Oriented Communication -
The Three-Way Handshake is the mechanism used to establish a reliable TCP connection between a client and a server. It ensures both parties are ready to communicate and can synchronize sequence numbers to track data packets.
Fig 03: Three-Way Handshake Process
Step 1: SYN (Synchronize)
Client → Server
-
The client sends a TCP segment with the SYN flag set.
-
This is a request to initiate a connection.
-
The client chooses an Initial Sequence Number (ISN), say
ISN = x.
🔧 Technical Details:
-
Flags: SYN = 1
-
Sequence Number: x (randomly chosen)
-
ACK Number: Not set (0)
-
Purpose: "I want to connect. Here’s my sequence number
x."
Step 2: SYN-ACK (Synchronize + Acknowledge)
-
Server → Client
-
The server receives the SYN, allocates resources for the connection, and sends back a SYN-ACK segment.
-
It acknowledges the client’s ISN and sends its own ISN, say
ISN = y.
🔧 Technical Details:
-
Flags: SYN = 1, ACK = 1
-
Sequence Number: y (server’s ISN)
-
ACK Number: x + 1 (acknowledging client’s SYN)
-
Purpose: "I received your SYN. Here’s mine (
y), and I acknowledge yours (x + 1)."
Step 3: ACK (Acknowledge)
-
Client → Server
-
The client sends a final ACK segment back to the server.
-
It acknowledges the server's ISN.
🔧 Technical Details:
-
Flags: ACK = 1
-
Sequence Number: x + 1 (next sequence number after SYN)
-
ACK Number: y + 1 (acknowledging server’s SYN)
-
Purpose: "I received your SYN-ACK. Here's my ACK."
TCP Segment Structure
A TCP segment is made up of a header (with control information) and data (payload). The header is typically 20 bytes long (minimum) but can be longer if options are included. Header fields: -
- Source Port Address: A 16-bit field that holds the port address of the application that is sending the data segment.
- Destination Port Address: A 16-bit field that holds the port address of the application in the host that is receiving the data segment.
- Sequence Number: A 32-bit field that holds the sequence number , i.e, the byte number of the first byte that is sent in that particular segment. It is used to reassemble the message at the receiving end of the segments that are received out of order.
- Acknowledgement Number: A 32-bit field that holds the acknowledgement number, i.e, the byte number that the receiver expects to receive next. It is an acknowledgement for the previous bytes being received successfully.
- Header Length (HLEN): This is a 4-bit field that indicates the length of the TCP header by a number of 4-byte words in the header, i.e if the header is 20 bytes(min length of TCP header ), then this field will hold 5 (because 5 x 4 = 20) and the maximum length: 60 bytes, then it’ll hold the value 15(because 15 x 4 = 60). Hence, the value of this field is always between 5 and 15
- Control flags: These are 6 1-bit control bits that control connection establishment, connection termination, connection abortion, flow control, mode of transfer etc. Their function is: -
- URG: Urgent pointer is valid
- ACK: Acknowledgement number is valid( used in case of cumulative acknowledgement)
- PSH: Request for push
- RST: Reset the connection
- SYN: Synchronize sequence numbers
- FIN: Terminate the connection
- Window size: This field tells the window size of the sending TCP in bytes.
- Checksum: This field holds the checksum for error control . It is mandatory in TCP as opposed to UDP.
- Urgent pointer: This field (valid only if the URG control flag is set) is used to point to data that is urgently required that needs to reach the receiving process at the earliest. The value of this field is added to the sequence number to get the byte number of the last urgent byte.
Flow Control -
It is a technique that manages the rate of data transmission between devices in a network to prevent data loss and network congestion. It can improve network performance, reduce retransmissions, and increase efficiency.
Ethernet frame Format (IEEE 802.3)-
- Preamble- 7 Bytes
- 56 Bits (10101010 repeated).
- Synchronization between sender and receiver.
- The alternating pattern of 1s and 0s helps the receiver to get ready to read the incoming bits.
- This field is not considered part of the actual Ethernet frame, but it's always transmitted before the frame.
- Start Delimiter Frame- 1 Byte
- refers to the flag or it indicates the start of the frame.
- Destination Address- 6 Bytes
- Specifies the recipient's MAC (hardware) address.
- Format is 48-bit MAC address (e.g., 00:1A:2B:3C:4D:5E)
- Source Address- 6 Bytes
- Specifies the sender MAC (hardware) address.
- MAC address same ass recipients address.
- Type/Length Field- 2 Bytes
- Specifies the protocol sending the packet such as IP or IPX (only applies to DIX frame).
- If ≥ 0x0600 (1536) → It's a Type field, specifying the protocol (e.g., IPv4, ARP).
- If < 0x0600 → It's a Length field, indicating the payload size in bytes.
- Frame Check Sequence (FCS)- 4 bytes
- Field Checksum Sequence or Frame Check Sequence is a Mathematical formula that uses a Cyclic Redundancy Check (CRC) algorithm, and detects the error during the data packets transmitted to the receiver point.
N:B:- Optional Field: 802.1Q VLAN Tag (4 Bytes)
- Inserted between Source MAC and Type fields (when VLAN tagging is used).
- Structure:
- TPID (2 bytes): Tag Protocol Identifier (usually 0x8100)
- TCI (2 bytes): Tag Control Info (contains VLAN ID and priority bits)
How Error Detection Code Work– Checksum
- Sender Side – Checksum Creation
- Break the data into 16-bit blocks.
- Add all 16-bit blocks using 1's complement arithmetic.
- If a carry occurs (value over 16 bits), wrap it around and add it to the result.
- Take the 1’s complement (bitwise NOT) of the final result.
- Put this value in the checksum field of the header.
Receiver Side – Checksum Validation
- Perform the same addition of all 16-bit blocks including the checksum.
- If the result is all 1s (0xFFFF) — i.e., no errors detected — the packet is accepted.
- If not, the data is considered corrupted, and the packet is discarded.
Data encapsulation and de-encapsulation are core concepts in computer networking, especially within the OSI and TCP/IP models. These processes ensure that data is properly packaged and interpreted as it travels across a network.
The encapsulated data is called by different names when it travels down following layers. Those names are called Protocol Data Unit (PDU).
Encapsulation (Sender Side) -
Encapsulation is the process of adding headers (and sometimes trailers) to data as it moves down the protocol stack—from the Application layer to the Physical layer.
📦 Step-by-Step Process:
-
Application Layer
-
Generates the original data (e.g., an email or file).
-
-
Transport Layer (TCP/UDP)
-
Adds a Transport Header (e.g., TCP or UDP header) with port numbers and sequencing info.
Now it’s called a Segment (TCP) or Datagram (UDP).
Now it’s a Packet.
-
-
Network Layer (IP)
-
Adds an IP Header containing source and destination IP addresses.
-
-
Data Link Layer (Ethernet)
-
Adds a Frame Header and Trailer (e.g., MAC addresses, error check codes).
-
-
Physical Layer
-
Converts the frame into bits (0s and 1s) and transmits over the physical medium
-
De-encapsulation (Receiver Side)
De-encapsulation is the reverse process. As the data moves up the protocol stack on the receiver’s side, each layer removes its corresponding header/trailer and interprets the data.
🔄 Step-by-Step Process:
Physical Layer
-
Receives raw bits from the transmission medium.
-
-
Data Link Layer
-
Converts bits to a frame, checks for errors, and removes the frame header/trailer.
-
-
Network Layer
-
Reads the IP header to determine source/destination, then strips it.
-
-
Transport Layer
-
Reassembles the data if needed, uses port numbers to direct to the right application, and removes the TCP/UDP header.
-
-
Application Layer
-
Presents the original data to the application (e.g., email software shows the message)
-


Comments
Post a Comment
Thanks