Thursday 29 October 2015

The Layered Approach (OSI and TCP/IP Models)

Understanding how data flows in a network is quite easy once you have a good understanding of the layered approach.

Using a layered approach helps to break down network functions in a very cool way.
You can think of a layered approach as a conceptual model that standardizes network functions without considering the structure of the network or the technologies in use.

Here, I will briefly talk about two models used to break down network functions: The OSI Model and the TCP/IP Model.

OSI (OPEN SYSTEM INTERCONNECTION) MODEL
The OSI model consists of 7 layers, (numbered from bottom up) that is used to standardize network communications and explain network functions.
OSI Model Layers (source: Google)



The functions of each layer of the OSI model are explained below:

LAYER 1 (PHYSICAL LAYER): This layer provides the hardware means for sending and receiving data on a carrier (cables, cards etc). Since cables understand electrical signals (0s and 1s), data passing through this layer are referred to as "bits".

LAYER 2 (DATA LINK LAYER): In this layer, data is encoded and decoded into bits, before being passed on the physical layer. Data in this layer can be referred to as "frames".
The Data Link layer is sub-divided into 2 layers namely: Media Access Control (MAC) layer, and Logical Link Control (LLC) layer. The MAC layer handles how computers on the network access data and whether they have permission to transmit it, while the LLC layer handles synchronization of frames, flow control and checking errors.
A switch usually resides in this layer

LAYER 3 (NETWORK LAYER): This layer provides routing (and switching) technologies, using logical addresses, and handles transmitting of data from source to destination. Data in the network layer is referred to as "packets".
A router is a device that commonly resides in this layer.

LAYER 4 (TRANSPORT LAYER): This layer handles end-to-end delivery of data. It also manages error correction and flow control. It ensures complete transfer of data.
Data at this layer is referred to as "segments"

LAYER 5 (SESSION LAYER): The main function of this layer is to manage connections between communicating devices. It makes sure that sessions are created, maintained and terminated once data transfer is complete.

LAYER 6 (PRESENTATION LAYER): This layer makes sure that the format of the data being transmitted can be read and understood by the application layer. It majorly encrypts the data to protect its formatting, and translates the data between network format (so it can be transmitted across the network), and application format (so it can be understood by the application layer).

LAYER 7 (APPLICATION LAYER): This layer handles user-interaction. The protocols that exist in the application layer makes provision for file transfers, e-mail, and other network services.
Everything in the application layer is application-specific, meaning that it depends on the application being used.

Please note that data at layers 5,6 and 7 of the OSI Model are still referred to as "Data". As it flows down the layers (from 7 down to 1), it changes to Segments, Packets, Frames and Bits at layers 4, 3, 2 and 1 respectively.



TCP/IP MODEL

TCP/IP stands for TRANSMISSION CONTROL PROTOCOL / INTERNET PROTOCOL
This model was proposed by the U.S. Department of Defense (DoD), so, it is sometimes referred to as the "DoD Model".

The TCP/IP model doesn't differ so much from the OSI model, only that it comprises of 4 layers (also numbered from bottom-up).
TCP/IP Model (source: Google)

Let's look at the functions of these layers:

LAYER 1 (NETWORK ACCESS LAYER): This layer defines how bits are signaled by hardware that interface directly with a network medium (cables, etc), and also specifies how data is physically sent through the network.
This layer of the DoD model maps into the functions of Layers 1 and 2 of the OSI model.

LAYER 2 (INTERNET LAYER): This layer maps into the function of the Network Layer of the OSI model. It packages data into IP datagrams (packets) that include logical address information used to forward data to the appropriate destinations.

LAYER 3 (TRANSPORT LAYER): Sometimes referred to as "Host-to-Host Layer", the Transport Layer of the TCP/IP model has the same function as the Transport Layer of the OSI model; i.e. handling transfer of segments from source to destination.

LAYER 4 (APPLICATION LAYER): The application layer of the DoD model combines the functions of the last three layers of the OSI model (Session, Presentation, Application).
This layer defines application layer protocols, and also defines how host programs make use of the network when interfacing with end users.



The following diagram shows the OSI and DoD models in contrast.

OSI vs TCP/IP Models (source: ccna-cme.blogspot.in)


...and there you have it! Network functions explained in easy-to-grasp conceptual models.
Your knowledge of the OSI Model and TCP/IP Model will go a long way in helping you achieve full understanding of network transmission, as well as provide ease in troubleshooting networks when problems arise.