Ping Google but not FB

Yogesh
2 min readMar 9, 2021

In this blog, I’ll be explaining a small network hack to make your system ping Google but not Facebook.

First, check the routing table of your system

route -n

Then find the Network names of Facebook and Google. Obviously, we won't find all the IPs of Google and Facebook. For this demo, I’ll be using the IPs from my ISP’s DNS server which can be retrieved using nslookup command or even pingcommand.

ping fb.com
ping google.com

Then, delete the route in the routing table which has the rule for all public IPs

route del -net 0.0.0.0

Now, both FB and google cannot be pinged

Now, all that left is to add the network name of Google

route add -net <Google_IP> netmask <Netmask> gw <Gateway>

Note: I used the netmask as 255.255.0.0 but you are free to use that single IP itself by setting the netmask to 255.255.255.255

Finally, we will now be able to ping Google but not Facebook

Thank You! 🥰

--

--