Create a Setup so that you can ping google but not able to ping Facebook from same system

Rishyani Bhattacharya
3 min readMar 13, 2021

In this article, I am going to create a setup in my system in such a manner that it can be able to ping the Google but not Facebook…sounds interesting? Let’s get started.

Firstly we need to check the route table in our system using the following command:


# route -n : to check routing table in the system
route -n

192.168.1.1 : is the default gateway provided by the router by which can travel to internet world

OBTAINING IP OF GOOGLE & FACEBOOK ?

We can find the IP addresses of www.google.com & www.facebook.com with the help of ping command :

 
# ping www.google.com
# ping www.facebook.com
ping google
ping facebook
Facebook: 157.240.198.35
Google: 142.250.194.100

DELETING UNIVERSAL ROUTE RULE :

By default router provides route rules in the table. In which first rule is defined as 0.0.0.0 , which is actually universal ip address(any ip in the world).That rule is the reason to get connect with the internet’s all the ip addresses. So we are going to delete this rule because we want to manually add ip addresses of google in this table so that it can only able to ping google.


# route -n : to get route table information
# route del -net 0.0.0.0 : removing route rule from table
0.0.0.0 RULE REMOVED

Now if you try to ping Facebook or Google it fails, as we have deleted universal rule from routing table.

ADDING GOOGLE IP RULE TO ROUTE TABLE :

Now let’s add Google’s IP address rule in the table, so that it can reach to the google.com


# route add -net 142.250.194.0 netmask 255.255.255.0 gw 192.168.1.1 enp0s3

Let’s check the route table again to verify whether rule is added to the table.

Rule added

So now let us check if we were successful

All setup is done…now let’s ping www.google.com

Ping successful

Now let’s try to ping www.facebook.com

Ping failed

SUCCESS!😃

Our system can now ping to Google but not Facebook!

THANK YOU!

--

--