Route and Routing Table

Subscribe to my newsletter and never miss my upcoming articles

Router

Router is a networking device used to forward data between different networks. A router is connected to two or more different networks. When the data comes to a router port, the router reads the address information and checks the routing table to determine out to which port the packet will be sent to.

router.jpg

When a packet arrives at a router, it examines destination IP address of a received packet and make routing decisions accordingly. Routers use Routing Tables to determine out which interface the packet will be sent. 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.

Routing table

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.

Command to check the routing table in Linux

route -n

1.png

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.

Entries in a Routing Table

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.

1. Network ID: The network ID or destination corresponding to the route.

2. Subnet Mask: The mask that is used to match a destination IP address to the network ID.

3. Next Hop: The IP address to which the packet is forwarded.

4. Outgoing Interface: Outgoing interface the packet should go out to reach the destination network.

Modifying routing table so as to ping Google but not Facebook

1. Check if the network is currently pinging to Google and Facebook.

2.png

2. Delete the default gateway from the routing table.

3.png

3. We will not be able to ping the websites now as the routing table entry is deleted.

4.png

4. Add the routing information for the google to conect.

4.5.png

5. Now we will be able to ping google but not facebook.

5.png

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.

No Comments Yet