A Simple Guide To The Network Layer Model (OSI)


Networking is not something a lot of developers look into. We assume that the requests come in from the network and the responses go out, without thinking about how the data is actually sent around. This is for the best, normally; network infrastructure is a field unto itself. However, in these days of micro-services, cloud computing and full stack development, you might be asked to make choices about the network, such as what load balancers to use and where. Therefore a basic understanding of the principles underlying these networks is very important.

One of the key concepts to understand is the idea of Network Layers. This breaks the passage of information around the network into several incremental ideas or abstractions, built on e on top each-other. Think of it like a house; you have the land, an architect will have to think of one way, then the foundations that are built into the land, which will have to thought of in a different way with a different set of knowledge, then the load bearing walls which again are different etc. until you have a full house. So it goes for the idea of a network. The actual name of this model is the Open Systems Interconnection Model, but that sounds far more intimidating that it actually is.

It’s really quite simple, when you break it down into questions…..

…questions that the architects of the internet had to answer at the beginning of all this. The detailed answers to these questions are far beyond the scope of this article (and even this blog!) but they frame the layers in practical terms

Question 1 (The Physical Layer): How do I physically connect two or more computers together? 

To answer this, a set of physical standards needs to be drawn up to describe the connectors and wiring that physically link two or more machines. Electrical information such as voltages are also defined, as well as bit-rate capabilities and whether the connection is simplex, duplex or half duplex (can the information go only one way or both ways)

Question 2 (The Datalink Layer) How do I get two computers to actually talk to eachother? 

How do we regulate data transfer and flow between two computers (or nodes)? How do they signal to each other? Detection and correction of errors at the physical layer is applied at this layer.

Question 3 (The Network Layer): How do we get several connected computers to work as a network?

Now that we have two or more computers datalinked (layer 2), how do we get them to route data between eachother? This is where the architects specify how data is split into packets, how individual nodes are addressed, and how data should be routed through different nodes. There is very little ‘quality control’ at this layer, or error detection; it’s just the bare bones of networking.

Question 4 (The Transport Layer): How do we build on the network layer to make it more reliable?

Protocols and specifications at this layer add error control and, crucially, the means to acknowledge that data has been successfully transmitted. A good analogy is the postal system; if the network layer is the postboxes and post trucks, then the transport layer (this layer) is the post office -it can provide ways of addressing misplaced letters, confirming receipts of packages etc. The most common transport layer is TCP (Transmission Control Protocol) which is what pretty much all of the web runs on, as it is reliable and provides segmentation of large messages into smaller ones as well, as the ability to acknowledge data that was successfully transmitted. An alternative is UDP which is less widely used and less reliable, but is actually quicker and more network efficient if reliability is not an issue (ie. multi-casting non critical signals to a large number of machines).

Question 5 (The Session Layer): How do we control the conversation between machines?

This builds on the transport layer, and establishes how nodes can gracefully navigate connections accross the network over the transport layer, including connection termination and restart processes.

Question 6 (The Presentation Layer): How do we prepare the data being transmitted over the network to be used by the applications?

What do we need to do to prepare the data to be used by the application (the program on the the computer on the receiving end of the data) Does the data need to be mapped to different formats/encodings? Does a serialised object need to be mapped to XML? Does compression need to be applied here?

NOTE: Not all mappings or transformations between what the sender is sending and the receiver is receiving need to be applied here. It’s more about mapping data that is represented in a network friendly way to a more application specific way. Think network to application semantics, not application to application semantics.

Question 7 (The Application Layer)

Now that we have all the physical, network and transport layers defined, and can transmit data effectively across a large network, what do we actually want to do with it? What do we want to send? And what protocols do we need to define to send it?

Hyper Text Transfer Protocol (HTTP) is of course the big one, along with it’s secure cousin HTTPS. But DNS (Directory Naming System), TLS/SSL, IMAP, POP and BGP (a routing information exchange protocol) are all  defined at this layer; in fact, if any application or system needs to define application specific network protocols, it will be at this level.


So in conclusion, networks can be thought of as several technologies or abstractions built upon eachother:

  1. Pysical
  2. Data Link
  3. Network
  4. Transport
  5. Session
  6. Presentation
  7. Application

It’s important to realise that the higher layers will use the lower layers: The mechanisms of the transport layer make use of the network layer, the network layer makes used of the data-link layer etc.

I hope this all makes sense and helps break down the ideas behind it. As ever, let me know your thoughts in the comments!




Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s