In this lesson, you will learn about Network layer and its role in delivery, forwarding and routing in a network. You must be familiar with all the layer of OSI and TCP/IP to understand this article, because in computer networks, each layer affect each other during communication.
Delivery of Packet
Network layer supervises the handling of packets by underlying physical networks. We call it delivery of packets to destination. Delivery of packets to final destination is done it two ways.
- Direct – when the destination is in the same physical network or delivery between last router and destination.
- Indirect – packet goes from router to router until it reaches the one which is connected to same physical network as the destination.
Forwarding of packet
Forwarding means placing the packet in its route to destination and it requires a Routing table. All routes for a routing device is available in the routing table.
- Next Hop method vs. routing method
In this method, the routing table contains only address of next hop instead of information about the complete route as in routing method.
- Network specific method vs. Host specific method
In this method, we reduce the size of routing table by replacing every host address on the same network by a single network address.
Where in Host Specific method, information about every host is included in the routing table.
Routing table of Host A based on route method
|Host B||R1, R2, Host B|
|Host B||R2, Host B|
|Host B||Host B|
Routing table of Host A based on next hop method
When the packet arrives it has a destination address which is not enough to locate the network of destination host. The routing table needs at least 4 field to find the network address of the destination, in classless addressing.
|Mask (/n)||Network Address||Next hop address||Interface|
For example: suppose a packet came with destination address 188.8.131.52 and is compared with different subnet mask. If the result is a network address in the table, then forwarding happen to that address.
|1011 0100||0100 0110||0100 0001||1000 1100|
180 70 65 140
|1111 1111||1111 1111||1111 1111||1000 0000|
If AND both mask and destination address, we get
|1011 0100||0100 0110||0100 0001||1000 0000|
180 70 65 128
The packet is routed to 184.108.40.206/25 in this way.
Classless addressing increases the size of the routing table because it divides the address space into many blocks.More the entry , more time required for searching the table. Address aggregation assign a common address for a block of address if the it is possible to combine the block of address, otherwise not.
Longest mask matching
The routing table entries are arranged in order where longest mask comes at top. Suppose we have /24, /26 and /27 . The first comes the /27, /26 and then /24 and so on.
Suppose a packet that arrive for destination 220.127.116.11 , then it will be ANDed with /26 and result will be 18.104.22.168 , but if the same address gets ANDed with some other mask , it will get routed to some other router.
In hierarchical routing, National ISPs have a block of address different from regional ISP address, and local ISP. All of them share a common ipaddress, but using the classless addressing scheme the addresses are subdivided into blocks at each level. Local ISP have a.b.c.d/m as common address , then it will have a block of address x.y.z.v/n as addresses.
Suppose 22.214.171.124/23 means 32-23 = 9
It means there is block size of 29 = 512 addresses.
At each level classless addressing is used and network is divided into blocks of addresses.
A routing table is either static or dynamic. In this section we discuss both routing tables.
Static routing table
A static routing table contains information entered manually. When there is a change in the network it does not get updated automatically, administrator has to enter them manually. It can be used in a small internet or experimental internet where we do not have lot of changes.
Dynamic Routing table
A dynamic routing table is updated periodically by one of it’s routing protocol such as RIP, OSPF or BGP. The table gets updated automatically whenever there is a change in the internet hence it is suitable for big internet.
Format of routing table
|Mask||Network Address||Next-hop Address||Interface||Flags||Reference count||Use|
- Mask – mask applied for the entry
- Network Address – network address or host address of the destination.
- Next-hop Address – address of next-hop router.
- Interface – name of the interface
- Flags – It is on/off flag that shows presence or absence. There are 5 flags
- U(up) – router is up and running.
- G(gateway) – destination is another network.
- H(host-specific) – entry in network address is host-specific.
- D(added by redirection) – added by redirection msg from ICMP.
- M(modified by redirection) – modified by redirection msg from ICMP.
Tools /Utilities – Packet Deliver and Routing
There are few important tool which is frequently used to check routing configuration or troubleshooting. These are the most popular ones and available with most of the system by default.
Netstat is very popular tool among IT people. There are many switches that will tell you a lot about the host and the network.
The ipconfig is the default networking utility for finding ip related information on the host. You can use ipconfig /all, ipconfig/ renew to get new ipaddress and ipconfig /flushdns to clear dns cache.
Tracert is a special utility that display all hop between the local host( computer) and destination ( google.com) in this example.
Andrew S. Tanenbaum, David Wetherall. n.d. Computer Networks. Pearson, 23-Jul-2013.
Behrouz A. Forouzan, Sophia Chung Fegan. n.d. Data Communications and Networking, Fourth Edition. mcgraw hill education.