An Extraordinary Network Setup Where You Can ping to Google but not to Facebook From the Same System
Tags: facebook, google, networks, ping
Published: 2021-03-26 02:30:55

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:
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4303d9l4ww4on4xqqrnx.png)
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.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wjtndp482rhh2oky6tr1.png)

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.

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iaqdbi4xef61yju8wg08.png)
  
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.

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0pmbw3rszmqyix36fvng.png)

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:

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1owesa05l1l5zutq6os4.png)
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:
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlpla4hf8lu4kzpxb9xr.png)
Thus now if we try to ping Google, It will be successful and We will clearly see the transmission of packets.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2l0hq5lmzw0wpggls634.png)
Now Let’s Try to ping Facebook.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au1hgtzri77qsc4n51is.png)
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.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mtcpz3py77hxbcioks0p.png)
Here We go, we are able to connect to Google. Lets Give a Try on Facebook.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhekch0q0g155skg2z3l.png)
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.
#That’s All. Thank You So Much For Reading😊
#Keep Learning, Keep Hustling.