Communication in a network has different layers and these different layers are mentioned in two different models. In other words,there are two common models in computer networking. These two common models are OSI Model and TCP/IP Model.
As a beginner, TCP/IP Model and the OSI Model is very important to understand the network world. The two common terms has also been a classical question of a network engineer technical interviews. What are the layers of OSI Model? How many Layers does TCP/IP Model has? Etc..
Let’s start with OSI Model and then continue with TCP/IP Model.
OSI Referecen Model is the first term that a network engineer learn. It is an important concept and generally always encountered especially at the technical job interviews of junior network engineers.
So, what is OSI Referance Model?
The first four Layers are the Lower Layers and the last three Layers are Upper Layers. Upper Layers are also the Application Service Layer of TCP/IP Model. OSI Model Lower Layers are a little different than TCP/Model Lower Layers.
So, Whats are the roles of these Specific OSI Referance Model Layers? Lets talk about one by one.
Physical Layer (Layer 1) is the actual connectivity between the source and the destination. It is the Layer in which the physical characteristic of the network is defined and bit flow tranmission is done.
Voltage levels and the meaningful 0 and 1 bits are transfered here. Basically it is the layer in which bit streams are transfered over different media types. Network cabling is Physical Layer activity.
Data-link Layer (Layer 2) is the medium provision Layer. It encodes and decodes the data in Frames. Encoding means adding a header at the source and decoding means removing this header at the destination. A Layer 2 Header is added in this layer and this header contains source and destination MAC Addresses. So it is responsable to find the next destination in the network.
The data after adding Layer 2 Header called “frame”.
Data Link Layer provides Error-free transfer of different categories of data frames. Ethernet is the most common Data-Link Protocol. Data-link Layer has two sub-layers. These layers are:
• Media Access Control (MAC) Layer
• Logical Link Control (LLC) Layer
The MAC Sub Layer controls how a computer on the network gains access to the data and permission to transmit it. And it carries the physical address of each device on the network.
The Logical Link Control (LLC) responsible for managing frames to upper and lower layers, Flow control mechanism and Error checking.
Some of the Data-Link Layer protocols are, PPP, HDLC, FDDI, ATM, Frame Relay and IEEE 802.3/802.2.
Network Layer is the Addressing and Routing Layer of the packets. It decides the path of the packets through the network. This is done via IP Addressing. Source & Destination logical addresses are given in this layer. And for IP, this is IP Addressing. A Layer 3 Header (IP Header for IP) is added in this Layer. After this addition frame called “packet”.
Frame fragmentation is also done in this Layer. If a Frame is longer than MTU (Maximum Transmition Unit), then it is fragmented( divided to the little packets).
In Network Layer, also the next level protocol will decided. It can be any Transport Layer (Layer 4),
Protocol like, TCP and UDP.
Some of the Network Layer protocols are AppleTalk DDP, IP and IPX. IP is the one, used internet and it is the most common one. Almost always you will focus on only IP as Network Layer Protocol.
Transport Layer (Layer 4) establishes, maintains and manages end to end connection. This layer is responsible for end-to-end Error Recovery and Flow Control. Transport Layer is also the Layer that QoS facilities also performed.
There are two common Transport Layer Protocols. These Protocols are UDP and TCP. There are also other Transport Layer Protocols like SCTP, RSVP etc. But here, at the beginning, we will focus on only the common ones.
According to used Layer 4 protocol, Layer 4 Header is added to the packet in this Layer. After this the packet called “segment”.
Basically, UDP is Unsecure, Fast and Connectionless protocol. This means that, it do not guarantee the delivery of the packets. So it do not have extra precedures for security. This makes UDP fast and usable for Voice and Video Applications. And for UDP, you do not need to establish any connection.
TCP is different that UDP. It has security mechanisms. So it guarantees the delivery of the packet, it is secure. With TCP, packets arrive Error-free, with no loses and in sequence. But this makes TCP slower than UDP. TCP is used mission critical applications and the applications that must have almost zero packet lost. For TCP, a TCP session must be established and this makes TCP, a Connection Oriented Protocol.
Session Layer (Layer 5) is the Layer, that responsible for Session Jobs between the end points. It provides Session Establishment, Termination and Maintenance. It also performes security, name recognition and logging. For example when two hosts try to establish a session on yahoo, this is done via Session Layer (Layer 5).
Presentation Layer (Layer 6) is the Translator of the network. There are many data formats in any network. There are different encryption and decryption mechanisms. For example different type of images(jpeg,gif etc..), videos needs different behaviours. Presentation Layer converts this different data into a readable format.
Application Layer (Layer 7) is the closest layer and interface between applications and the underlying Layers. It provides the provision of the communication between Applications.
Some of the protocols used in Application Layer are Telnet, FTP, SMTP, HTTP etc.
Note: The Application programs do not belong to the Application Layer. So, Application Layer is not the browser that we use, but the common protocols used by the browsers (http, https).
As you know in a network there are some common network devices like Hubs, Repeaters, Bridges, Switches and Routers. These devices operates in different Layers of OSI model. Lets check this devices and the Layers they are used.
Everything begins with the data at the Application Layer. Then through out the destination, in each Lower Layer, an additional Header is added to these Data. And at the Physical Layer, all these are send via 1s and 0s as voltages over the cables.
What are these Headers and how effects the data?
• At Transport Layer, Layer 4 Header is added. Here the name of “Data and Layer 4 Header” is “Segment”.
• At Network Layer, Layer 3 Header is added. Here the name of “Data and Layer 3 Header” is “Packet”.
• At Data-Link Layer, Layer 2 Header is added. Here the name of “Data and Layer 2 Header” is “Frame”.
• At Physical Layer, all of them is translate to 1s and 0s as voltages.And these values are sent and received over different media types(cables).