A Setup by which one can ping Google but not Facebook

Task Description :(13)

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

Before we begin it's important to understand a few concepts by which we will be completing the provided task.

Routing Table

A routing table contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination. Routing Table provides the device with instructions for sending the packet to the next hop on its route across the network. A routing table is a database that keeps track of paths, like a map, and uses these to determine which way to forward traffic. A routing table is a data file in RAM that is used to store route information about directly connected and remote networks.


A Netmask is a 32-bit “mask” used to divide an IP address into subnets and specify the network’s available hosts. In a netmask, two bits are always automatically assigned. For example, in, “0” is the assigned network address. In, “255” is the assigned broadcast address. The 0 and 255 are always assigned and cannot be used.

Netmask defines how “large” a network is or if you’re configuring a rule that requires an IP address and a Netmask, the Netmask will signify to what range of the Network the rule will apply to.


A switch is a device that is used to connect computers whose IP address comes in the same range or network.


The router is a device that is used to connect computers whose IP address comes in a different range or network.

Now it's possible to create a system that will be able to ping google but not Facebook, for that we have to see our routing table.

# route -n command is used to see the routing table

So if we try to ping google and Facebook now it will ping also send and receive the packets too because of the global IP

In order to attain our system, we should first delete the global IP and change the routing table rule. So after deleting the global IP, the next thing to do is creating a rule so that we can ping only to google for that we should know the IP of google, it can be seen when we ping to google as shown above or we can use nslookup www.google.com command.

Now if we try to ping google as well as Facebook the packets won't be received as well as sent to them.

The next step is the changing rule for that will enable to ping google whose IP is Here for this, I have taken and netmask as which will enable the system to connect to all the IPs in the range to

Now if we ping google and Facebook lets see what happens

While pinging to Facebook it's showing that the destination is unreachable and the packets are not received as well as sent.

The same is applicable when opening the browser too!

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