Let’s Experiment With Something Interesting Using Route Table
In this article I would be creating a network by which we can able to connect with google but not with Facebook in spite of having internet connectivity, So to achieve this network topology we will be using route tables.
So let’s start with the experiment
First, we will check whether we have internet connectivity and can be able to connect with Google and Facebook using the ping command.
ping -c 2 google.comWe can see that now we can ping to google and Facebook as well not let's check the routeing table but using the command
route -nWe can ping due to this route table where it is written destination Ip 0.0.0.0 and the genmask is 0.0.0.0 that means generate the packet no matter what is the IP my system will generate packet or we can say my system is allowed to connect with any network it wants and the gateway it will use to send the packet is 192.168.0.1 it is IP address of my router which will act as a gateway to send my packet to the outside world.
Removing rule from Route table
Before removing the rule lets just note the Ip of google as after removing we cant be able to connect with the internet and also it is required to perform this experiment so for this we will use the nslookup command or we can see the IP of google in the ping command also
nslookup google.com
So the IP of the google to which my system send packet is 172.217.167.46
Let’s just remove this rule so for removing any rule from the routeing table we will use the command
route del -net 0.0.0.0Now let's check our route table again
So What’s the issue?
This is the place where the routeing table come into play without a routeing table we cannot able to connect with the internet even if we are having a connecting, this route table is the only which allow our system to generate packet in the case my system is not allowing to generate packet as the rule is not present in the routeing table.
Adding rule for Route table
So let's just add the rule to only allow to connect with the Google servers by explicitly giving the Ip range of google servers by using the command
route add -net 172.217.0.0 netmask 255.255.0.0 enpos3Now let's check can ping to google servers or not
So there is another rule that comes up where the gateway is my router through which packets gets exchanged.
Let's just try to ping google
My system can connect with google now let's just try the same thing with Facebook and see what's the status with Facebook.So we can see that Facebook is still not pingable
Does the thing only happen with the ping command or if we will try with our browser same thing will happen let's check?
So we can access google now let's check for Facebook as wellWe cant able to connect with Facebook through the browser as well despite having internet connectivity.
If you want to reset these setting of route table you can just add a rule or simply switch off device network connecting and then turn it on as router have DHCP server which will automatically build route table for us and now you are back to normal.
Conclusion:
Having an internet connection is not enough to connect with the network, the routeing table is also one of the important key aspects of connection. Today we have experienced the Power of Route table how it works and the basic terminology of Networking.
Hopefully, you learn something new from the article as well as enjoy it.
Thanks for reading this article! Leave a comment below if you have any questions.
Comments
Post a Comment