Able to ping google but not Facebook

Pratyush Pathak
3 min readMar 16, 2021

--

Task 13:

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

By default in our routing table there is a rule which allows us to ping (create a packet and send) to all the IP range (0.0.0.0) throughout the internet.

command to check the routing table:

route -n

Because of this rule for now you are able to ping both google as well as facebook, if we try pinging both as:

ping www.google.com
ping www.facebook.com

Now if you will delete that rule from the routing table, then you won't be able to ping any server (for now we are talking about google and facebook only)

We can delete the rule using command:

route del -net 0.0.0.0

Now if you check the routing table route -n, that rule is deleted

Now if you will try pinging you won't be able to ping both of them

So for pinging google we have to add google IP rule in the routing table and to find the IP of google we can use nslookup command as;

nslookup www.google.com

The IP of google server is 142.250.183.132, now we can add a rule in the routing table as the network is 142.250.183.0

route add -net 142.250.183.0/24 gw 192.168.43.1 enp0s3

and now we can check the routing table whether the rule is updated or not using route -n

Now if we will ping to google it will be pinging and for facebook it won't

Here i'm using ping -4 for ipv4

ping -4 www.google.com

ping -4 www.facebook.com

and it's done!! ✔

That's all

I hope you liked it.

Thank you! :)

--

--