Hello Readersđ,
In this article, I am going to show you all an extraordinary setup of networks where You can ping to Google but not to Facebook.
Isnât it FascinatingâŚ
This setup requires some basic foundations in Networks but donât worry Iâll try to explain all the steps from scratch and after reading this article you will able to do this setup very easily. So without any Further Delay Letâs Get Startedââ.
Whenever we ping to any IP address, our network program internally first checks the routing tables to confirm that does the IP we are pinging to typically called destination IP lies in network range or not. NetMask is responsible for deciding the range. If the destination IP doesnât belong to the same Network Range, then our system will not generate packets. As it will not create any packet. It will not ping.
So Letâs Start with the setup. Here we will use RedHat Enterprise Linux-8 as our Base OS.
As discussed, We have something called routing tables. For a network, to know where to send packets of data it receives, it uses a routing table. The routing table contains a list of specific routing destinations. When the router receives a packet of data, it references the routing table to know where to send that data. The routing table may also contain information on how far each destination is from the router. In essence, a routing table is a map for the router.
The Routing Table of our System is shown below:
From The Above image, We can see that in our routing table, we have 2 rules. The first is that belongs to our netmask 192.168.0.0 and the Second one 0.0.0.0 is the default gateway with 0.0.0.0 as netmask, used to connect to all IP(s) available.
By using this default rule 0.0.0.0 we are able to ping Google, Facebook, or any other IP.
Now for this interesting setup, we have to delete this by default rule 0.0.0.0 using the command â route del -net 0.0.0.0. After running this command in the terminal we can see in the routing table, we donât have that rule.
Also, Notice That Now we are not able to ping Google and Facebook. This is because we deleted the by default rule using which were able to ping to both of them. Hence the packets arenât created and it shows Network is unreachable.
Now we have to add the new rule in the routing table so that we can ping to Google. For that, we must now the IP address of Google. nslookup is a command in RHEL8 which helps us to do that.
So, There it is. The IP address is 172.217.167.164. We have to add a rule in routing table. Command to add rule can be seen in image below:
Here we add â/30â which is netmask or typically known as prefix length. Further âgwâ option is used to specify the gateway and at last we have to specify, the network card name in our case it is enp0s3.
After running the above command the route table looks like:
Thus now if we try to ping Google, It will be successful and We will clearly see the transmission of packets.
Now Letâs Try to ping Facebook.
See it shows the network is unreachable, It means even the packets are not created.
Voila, We did It.
Letâs Try to do same task from Firefox browser.
Here We go, we are able to connect to Google. Lets Give a Try on Facebook.
It shows Unable to connect. This is because we have specified the rule in the Routing table which only belongs to the Google.
So our the Setup of Extraordinary Network is Successful. I hope You get something new out of This setup.
Top comments (0)