Creating a network setup that can ping Google but unable to ping facebook from the same system

We will follow step by step to create this setup.

Step 1:

First we check the connectivity with the both and and

Here we can see that we are able to ping both and But we want a setup that can ping to google but not facebook.

Step 2:

We have to understand how our local system can ping to online servers .

When we ping to any server, Our system send packets to that server, but to send the packets our system must have rule for that server ip range , If the rule is not available in the routing table then, our system can’t ping to that server.

Since, we are able to ping both google and facebook, so we have to check the routing table.

Here we can see that there is destination= and Gateway= ,by this rule our system is sending packets to the servers of google and facebook,So If we delete this rule ,then our system can’t ping to google or facebook or any other online servers.

step 3:

Before deleting the rule from the routing table ,first get the ip of google and facebook for further use.

[root@localhost ~]# nslookup & nslookup

So we got the ip of and ,Now delete the rule.

[root@localhost ~]# route del -net

Now, We will try to ping google and facebook, and lets see what are we getting.

So, now our system is unable to ping to both and or any other online servers,because we dont have any rule for it in our routing table.

Step 4:

Since we don’t have any rule to ping outside world ,but our requirement is to ping

So we will create a rule in the routing table for the google, so that our system can ping to

[root@localhost ~]# route add -net gw netmask enp0s3

the ip we got from the ‘nslookup’ command of the google( is a part of range of google ip( —, so the netmask for this ip range will be, so our destination will be and our gateway will be

Step 5:

Now let’s check whether we are able to ping or not and what about

Here , we can see that after adding the rule we are able to ping But we are unable to ping,because we don’t have any rule for its ip range.


We have successfully created the setup that can ping google but unable to ping facebook.

Thank you!!

Tech learner

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store