Setup A System that can ping Google but not Facebook

Siri Chandana
4 min readApr 9, 2021

Hello Everyone, Welcome again !!!!!

In this article, i am going to manipulate my system in such a manner that it can be able to ping the google but not Facebook.

We can achieve this with the help of a Routing Table, so let’s first discuss what Routing Table is.

Routing Table :

A routing table is a type of data file that acts as a map and is often installed on a router, networked computer or other hardware. The routing table contains information about various routes between devices in order to present the most efficient paths for data packets.

A routing table uses static and dynamic Internet protocol or IP addresses to identify devices, and works with an ARP cache that holds these addresses. The routing table is commonly referred to as a resource for finding the next hop, or subsequent route for a data packet. Static or dynamic routes may be compared in order to find the best path for data.

Now we have discussed the Routing Table so let’s start with the demonstration

We can see the routing table in our system by using these command:

command :
# route -n : to check routing table in the system

Here you can see the routing table with the default rule that is destination 0.0.0.0, this means we can connect to anyone.

192.168.43.1 : is the default gateway provided by the router by which can travel to internet world.

Now let’s check are, we able to ping Google

In order to ping Google use the command ping www.google.com

Now let’s check are. we able to ping Facebook

In order to ping Facebook use the command ping www.facebook.com

We have to find the IP of Facebook and Google. for these we can use nslookup command.

nslookup www.google.com

nslookup www.facebook.com

address of google
address of Facebook

Obtained IP addresses of google and Facebook :

google: 142.250.67.68

Facebook : 69.171.250.35

🔰 DELETING UNIVERSAL ROUTE RULE :

By default router provides route rules in the table. In which first rule is defined as 0.0.0.0 , which is actually universal ip address(any ip in the world).That rule is the reason to get connect with the internet’s all the ip addresses. So we are going to delete this rule because we want to manually add ip addresses of google in this table so that it can only able to ping google.

! command
# route del -net 0.0.0.0 : removing route rule from table

After deleting this rule, now if you try to ping facebook or google it fails, as we have deleted universal rule from routing table.

🔰 ADDING GOOGLE IP RULE TO ROUTE TABLE :

Now let’s add google’s ip address rule in the table, so that it can reach to the google.com

!~ commands: 
# route add -net 142.250.67.68 netmask 255.255.255.255 gw 192.168.43.1 enp0s3

Now check if we can ping Google

To ping, google use the command ping www.google.com

Here you can see, we are able to ping Google

Now check if we can ping Facebook

Here you can see, now we are not able to ping Facebook but we are able to ping google.

SUCCEED 👍, So as you can see our system is able to connect to google but not facebook. I hope you liked this article…

Thank you for reading 📖.

Keep Learning ✌.

--

--