# 3. Network Layer
The Network Layer is responsible for handling the data transfer between two different networks. This means that this layer is not needed if the receiving device is on the same network.

The Network Layer breaks up segments from the Transport layer into smaller chunks called [[Packets]]. The reverse happens on the receiving device (reassembling packets into segments). 

Furthermore the Network Layer also finds the optimal path to travel from origin network to the destination network. This is called routing.

## Routing
Routing is finding the shortest (most efficient) path from source to destination and forwarding the messages over that calculated path.

Routing is difficult because it has to deal with a lot of things:
- Network topology may change.
- New hosts may be added.
- Some connections/hosts may be removed.
- Distance between hosts may change.

Routers use tables called routing tables. The table contains the next point on the shortest path to each destination.

Steps:
1. Routing: Finding the most efficient path(s)
2. Forwarding: Send info to the nest point from the routing table.

A router can not practically store all hosts in the table as that would be way to many.

So instead the router stores only possible destination networks.