What is Routing?
Routing is a mechanism that allows a system to find the network path to another system. A routing table is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes.
Switch to the practical part
First, let’s print the routing table in our Linux OS:
Here (in the image above), you can see that the gateway is configured already and the OS connected to the internet. To check if our OS is connected or not, we can ping to Google.com
In the above image, you can see that our system is working perfectly fine and it is able to ping Google.com. Similarly, let’s ping to facebook.com to see if it can ping to facebook.com or not.
Now, everything is fine and working as expected.
Firstly, we’re going to delete the default gateway from the routing table.
route del -net 0.0.0.0
Now, one record of the routing table is deleted successfully.
Now, we’ll add one rule in the routing table through which it can ping to google.com only.
route add -net 184.108.40.206/24 gw 192.168.42.57
We’ve configured our system (Linux OS) such that it can ping to google.com but not facebook.com by doing some modifications in the routing table.
Cheers to reading!