Use Networking concept to setup in such a way, you can ping google but not Facebook
You must have heard of routing table . If not let me tell you its a table that is used to tell the packet where it can travel in a network. So before any packet is send ,the OS see that does it violate any rule or not. If yes don't make the packet for the IP ,if not packet are made.
So we will create routing table such a way that Facebook can’t be pinged.
For that we need to know the IP of Facebook and Google both
So to know the IP of Facebook you can use “nslookup” command or just directly ping the domain you will get the IP.
I'm able to ping Facebook
Know let get IP of google
Able to ping google
Changes in Routing Table
1.route -n show all the rule of routing table
2.Deleting the Gateway Rule.
if you don’t know what's gateway let me tell you its the route through which your OS system connect to entire world
After deleting if you try pinging to google and Facebook you won’t be able to ping
3.Setting customize Rule
So we want google to be able to ping and not Facebook .So we will create rule of Google ,so that it knows where to go. So google IP is 216.58.199.174
route add -net 216.58.199.0 netmask 255.255.255.0 gw <your network gateway> <network card name>
So what this above rule tells your computer that any host on the network 216.58.199.0/24 (216.58.199.1–216.58.199.254) is accessible via the router 192.168.43.201
And now as there is no rule for the IP of Facebook i.e. 31.13.79.35 in routing table your computer don’t know from which route it should sent those packet to..
Now ping the google and Facebook
You can see we are able to ping the google but not the Facebook, just using Networking concept.
Note: 216.58.199.0/24 and network 216.58.199.0 having netmask 255.255.255.0 are same. Its the way of writing . /24 is the netmask 255.255.255.0
Grazie, for your precious time👋