Ping To Google But Not To Facebook

Yash Sankhla
3 min readJan 6, 2021

--

Hello Connections,

From the heading, you might be confused about what I want to show to you all. Let me tell you all the things, first of all, let us understand what PING is.

PING(Packet InterNet Groper) is a protocol used to check the network connections between two devices. If two devices are pinging then there is a successful connection between them. In the Internet world, we are able to connect everyone by default which basically means that we can control whom we want to connect or not. This is done with the help of a ROUTING TABLE in which rules are mentioned for your network as ROUTER is the one who takes you to the Internet. Now, let’s see how the setup looks like.

Firstly, I am showing my routing table to you all you can use the following command to do this:-

route -n

Routing Table

The highlighted text basically means that we are allowed to go or ping anyone on the internet.

Now, let’s give a try to ping Google & Facebook, for it, we have to first find the Public Ip Addresses of Google & Facebook after that ping them. You can use the below commands to do the tasks:-

nslookup www.google.com

To Look Google Ip Address

ping 172.217.31.4

Ping Google Ip Address

From the above image, the highlighted text means we can SUCCESSFULLY ping to Google. Let’s check this for Facebook also.

nslookup www.facebook.com

To Look Facebook Ip Address

ping 69.171.250.35

Ping Facebook Ip Address

From the above image, the highlighted text means we can SUCCESSFULLY ping to Facebook also. Now, we have to set our routing table in such a way that our router denies to connect Facebook. For this, I write add a rule in the table for facebook IP as not to connect to it and check the routing table for these changes, we can use the following command for doing this:-

route add -net 69.171.250.0 netmask 255.255.255.0 reject

Facebook IP Disconnection

Now, let's quickly check again about the connections of Google & Facebook. Don’t forget we had to make our connection to Google not to Facebook.

For Google:-

Which gives us a successful connection. Now let’s check for Facebook is it still pinging or not.

For Facebook:-

Here, we got our solution NO ROUTE TO HOST, what we want.

So, that’s all for today we had successfully built our setup. Hope you have no doubts regarding this if have any, please connect to me. I will definitely help.

Thank You,

Keep Learning

--

--

Yash Sankhla

ARTH Learner * Cloud * AI/ML/DL/NN * DevOps * Hadoop * Web Dev * DB-SQL & NoSQL* DSA * RHEL 8 * Image Processing * Languages — C, C++, Python