Headers and The OSI Model – A brief explanation

If you want to know how “logically” the message you send on facebook reaches the other end to your friend, This post will give what you want to know. You must know that this is the “logical way” and I’ll be posting how it goes on the physical network in my next post(about which many of you might know), Whenever it comes to the “logical way” The First thing that pops up into a network engineer’s mind is “tcp/ip model and osi model” The OSI Model is widely adapted, So we’ll discuss about that one.

The OSI model is just model, and understanding how it works is makes you understand  the core networking concepts. In this post, I’ll discuss about “How this imaginary model actually gets to work and why and  how  the headers work ”.

There are 7 layers in the OSI model as you might know if you are spending some time with networking, basically talking about headers and the osi model, one thing pops up and that is “Encapsulation” to encapsulate means, to augment the data with headers, about which we’ll be discussing in this article. In some particular cisco or non-cisco documentation, you’ll find that “encapsulation” means data hiding , That’s is true when it comes to the 6th(Presentation Layer). Because That’s what that 6th Layer of the OSI Model Does.

So, When we use Facebook or twitter we are actually sending a HTTP get request (not every time though), The User Using Browser  is at application layer, He sends the a piece of data to somebody, the browser does what it needs to be done in the preceding layer that is the presentation layer and then it goes down the transport layer and so on. When we send data through the internet, we need to encapsulate “packets”(data called at network layer) with headers as well. And Encapsulating your data is what practically the imaginary OSI model does.

So that data/message need to have an source and destination IP address and a mac-address, both are mandatory for a successful connection, So as the message goes down from the application layer, each layer adds its own header down to the physical layer (this is what encapsulation is). And mind it, datalink layer adds a header and a tailer both and physical layer adds none, Every layer have to add their own control information about which we’ll be discussing later.

Now let’s Discuss about the OSI model again, When the data comes down to the transport layer the whole data is converted into “segments”(Data is called segments at transport layer) or maybe only a only a portion of it is converted i.e. the Transport layer adds it’s header to the data and we call it the header Payload and payload is a general term of adding something to the main data, You’ll Hear about payload a lot if you are associated with security.

Don’t confuse yourself  by mixing segments and payloads. Payloads are the Headers, you may call the combination of data and layer specific header/payload  PDU’s(Protocol Data Units).
For Example,

Layer4 Segment= L4PDU
Layer3 Packet = L3PDU.
Layer2 Frames=L2PDU

Now, the segment gets down to Layer 3 (Network layer) where by adding L3 header, the segment becomes a “packet”. Then down to Layer2(Datalink Layer) this adds a layer2 header and a tailer and makes it a “frame” and the then goes down the physical layer (Wires and Electronics) and to your friend on facebook, Data reaches his NIC on this computer and then goes up to datalink layer, datalink layer decodes the datalink layer header and tailer and then data goes up to network layer where his L3 decodes the L3 header from your PC and so forth.

And this may sound physical(the OSI model) but it’s not. and going up it reaches the application layer and Google Chrome pops up in his PC with your message!

Now why on earth does every layer have to add their own control information? Why Headers? 
Well because, it allows the machines to distinguish between the messages. For instance the Layer 3 header contains the source and destination IP addresses of the next hop and Layer 2 header contains source and destination mac addresses and you can guess the forth part.

Here, More header means move overhead, now the headers don’t take like half of the packet size but still it does what we call he overhead and makes the data heavier. And this relates to packet switching and circuit switching but we’ll not discuss it here.