I just started reading communication networks.
Now, routers contain the network layer, data link control layer and physical layer.
That being true I am confused as to why the network layer is required or to be more specific what is its function.
In "Computer Networks A top-down approach", it is written that the network layer inspects the datagram header to look at the source and host addresses and then passes the datagram to the data link layer of the next link for it to decide where to pass the data packet to.
Network layer does not seem make any changes to the headers associated with the data packet or modify the headers in any way. This begs the question, what does the network layer then do???

  • $\begingroup$ Maybe you should read on. $\endgroup$
    – Raphael
    Oct 3, 2016 at 10:06

2 Answers 2


There are only three high level abstractions in the network stack.

Link Layer: Knows how to transfer data (physically*) across one hop. This layer with deals encoding and framing bits, controlling channel access, detecting and recovering from collisions in the transfer medium. Eg: Ethernet, WiFi etc.

Network Layer: Does forwarding and routing (note: they are different procedures). Knows how to forward a packet to the destination. Has a table of IP-->link mapping. Let's assume your router/switch has three links, it decides (and only knows) which link to take to get closer to the "destination IP". Delegates the physical mechanism of transferring bits on that link (which may be Ethernet or WiFi or whatever) to the link layer. Once your router finds that the "destination IP" matches "your IP" it makes an up-call to the End to End layer, i.e, no more links have to be traversed. Eg: Internet Protocol IP. Just to be concrete, a router has a forwarding table which has the following form,

Forwarding Table
IP address   Link to take
"Your IP"    E2E layer
127.35.*.*   link 2
10.*.*.*     link 3
173.*.*.*    link 1

These individual links may be Ethernet or WiFi or DSL etc. Note: an intermediate gateway/switch may not have E2E layer implemented.

Packets in the network layer may get dropped due to congestion, link failures or may not reach destination due to a wrong route.

The links layer and the network layer taken together is just a "BEST EFFORT" dumb network, that doesn't guarantee: ordered delivery, delay limits, congestion control or any form of reliability that a practical application might require. It tries its best to take the packet through but it is not assured. It does not guarantee end to end delivery.

To answer your question, packet routing is in itself a hard problem which requires implementing an abstraction called the network layer for this purpose. Look for "Path vector routing", "BGP" to understand how network layer prepares these forwarding tables.

End to End Layer: This builds on top of the network layer, requests re-sending of lost messages, acknowledgments, arranges out of order segments, manages resources like timer etc. It works to ensure, whatever the sender sent has arrived intact. Eg, TCP, UDP

*Link layer doesn't always mean physical transmission, for details, read about recursive network stacks like Gnutella


Network layer is required for routing purposes. The network layer at router takes the destination IP address of the packet and compares it with its routing table. Next hop of the packet is decided by seeing the routing table.

The table helps to decide the router whether the packet belongs to its subnet or not. In case the it belongs to the subnet of one its interface, the packet is directly forwarded to the node. Otherwise the next hop IP Address is provided, which helps the router to forward the packet.

Suppose a router has four or five interfaces. Whenever a packet arrives from one of it's link, it must be able to forward it to one of its four or five outward links, in order to make sure that the packet eventually reaches destination.

I think you just skimmed over the book. Take another look to the book. The book clearly explains everything. The Network and Transport layer chapters have tonnes of information. Make sure you know most of them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.