![]() |
VOOZH | about |
A Router is a networking device that forwards data packets between computer networks. This device is usually connected to two or more different networks. When a packet arrives at a router, it examines destination IP address of the received packet and makes routing decisions accordingly. Routers use Routing Tables to determine which interface the packet will be sent out. A routing table lists all networks for which routes are known. Each router’s routing table is unique and stored in the RAM of the device.
A routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables. See below a Routing Table:
Destination | Subnet Mask | Interface |
|---|---|---|
128.75.43.0 | 255.255.255.0 | Eth0 |
128.75.43.0 | 255.255.255.128 | Eth1 |
192.12.17.5 | 255.255.255.255 | Eth3 |
Default | 0.0.0.0 | Eth2 |
The entry corresponding to the default gateway configuration is a network destination of 0.0.0.0 with a network mask (netmask) of 0.0.0.0. The Subnet Mask of default route is always 0.0.0.0 .
A routing table contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination. Routing Table provides the device with instructions for sending the packet to the next hop on its route across the network. Each entry in the routing table consists of the following entries:
Routing table entries can be used to store the following types of routes:
When a router receives a packet, it examines the destination IP address and looks up into its Routing Table to figure out which interface packet will be sent out.
There are 3 ways to maintain Routing Table:
These Routing tables can be maintained manually or dynamically. In dynamic routing, devices build and maintain their routing tables automatically by using routing protocols to exchange information about the surrounding network topology. Dynamic routing tables allow devices to "listen" to the network and respond to occurrences like device failures and network congestion. Tables for static network devices do not change unless a network administrator manually changes them.
Consider a network is subnetted into 4 subnets as shown in the above picture. The IP Address of the 4 subnets are:
👁 Routing Tables200.1.2.0 (Subnet a) 200.1.2.64 (Subnet b) 200.1.2.128 (Subnet c) 200.1.2.192 (Subnet d)
Then, Routing table maintained by the internal router looks like:
| Destination | Subnet Mask | Interface |
|---|---|---|
| 200.1.2.0 | 255.255.255.192 | a |
| 200.1.2.64 | 255.255.255.192 | b |
| 200.1.2.128 | 255.255.255.192 | c |
| 200.1.2.192 | 255.255.255.192 | d |
| Default | 0.0.0.0 | e |
To find its correct subnet (subnet ID), the router performs the bitwise ANDing of destination IP Address mentioned on the data packet and all the subnet masks one by one.