Networking: Understanding how protocols work
Whats is a protocol? Whats is the OSI model? What is encapsulation?
Thanks to protocols, machines and computers can communicate together. Since information is transmitted in packets (streams of bits), a protocol allows the successful transmission of packets from one device to another. Such information can be transmitted via a physical wire or by the mean of a wireless network (WiFi).
The Packet
A packet is composed of a header and a payload.
The payload is the actual information contained in the packet.
The header is specific to a protocol and allows the receiver to interpret the information contained in the packet. It has the function of an "etiquette".
For instance, if we examine an IP Header, we can easily read the version of the protocol (IPv4, IPv6), the source address and the destination address.
The IP Header (Source: INE)
The OSI model ... or not
OSI stands for: Open System Interconnection Model. It consists of 7 layers and is a theoretical model for network systems communication. It defines how protocols cooperate in order to transmit successfully the packets. However, for a basic understanding of networking, you will not need to learn this model. Instead, let's focus on the 4 fundamental layers (you'll need this to understand the TCP/IP protocol).
- Application Layer: exchange emails and files -->make an application
- Transport Layer: establish a communication between a server and a client --> transport data between the two
- Network Layer: identify hosts (computers) on a network
- Physical Layer: use the physical media to send packets Every layer has its own protocols.
Protocols Encapsulation
Every layer serves the one above it. Since then, an upper layer doesn't need to do what the underlaying layers do. This is called encapsulation: the entire upper protocol packet (the information and the header) is the payload of the lower one. Here is an illustration:
(Source: INE)
Hence, during encapsulation, every protocol adds its header to the payload of the underlaying protocol. This process takes place for every packet sent.