In this part, we’re going to talk about the Network Layer. As we went through the Data Link specifications before, the Data Link layer adds the source and the destination physical address (MAC) to the packets, data will enter the next layer of OSI model which is the Network Layer. This layer is the 3rd layer in the network OSI model.
The Network layer is responsible for logical addressing. Contrary to MAC address which is hardware-specific and cannot be changed, logical addresses can be assigned by a network administrator. Internet protocol (IP) is the logical address that we are talking about.
In addition, the Network layer is responsible for finding the best path from source to destination. Most routing protocols function at this layer in order to determine the shortest and most efficient route.
Network layer concepts
Before we get into how a Logical address is used in the Network layer, we need to get familiar with two main concepts in this layer. These concepts are Logical Addressing and Routing (or Forwarding) which we will explain in the next paragraph. So stay tuned.
Logical network addressing
Except MAC address, we need another address to send data. In the previous article (Data link layer in OSI model) we learned that every network devices has already a predefined physical address (MAC). Now you might think why we need another address in order to send data.
The fact is that networks cannot work efficiently enough with only MAC address. The reason is that finding the receiving machine’s MAC address is not easy only by relying on the physical level’s capability.
We need other layers of the OSI to also contribute in the address resolution process. This is where logical addressing comes to help which does the job of address resolution much smoother than MAC address.
Same as Data Link layer adds the source and the destination MAC addresses to data packets, Network Layer also adds the source and destination logical addresses (IP) to the packet. When the packet arrives at a layer 3 device such as a router, the device looks for the destination IP address inside the packet and delivers the data to that address only.
IP address is 32 bit in length in decimal format. Each decimal number in an IP address is typically a number in the range of 1 to 254. Each number is divided by dots for easier reading. Below is an example of an IP address which consists of four groups of numbers separated by a dot: 192.168.1.1
The Network layer is also responsible for Routing. It is the process of finding the shortest and quickest path to a destination in another domain and deliver the data through that path. This is the job of a router.
Routers have a table known as Routing Table. As a router continues working inside a network, it builds up an inventory of the logical addresses in the network and also the shortest path to reach them.
Whenever data reaches the router, it reads the destination IP address within the incoming packet and looks for that address in its routing table. If the address is found, the router will forward the packet to that address by using the route that is associated with this particular address.
Routers learn logical address via two methods:
- Static Routing
- Dynamic Routing
We will explain the technical specs of both of these methods in detail in the next articles.