Setup to ping GOOGLE but not FACEBOOK

Palak Jain
3 min readMar 15, 2021

In this blog, we will create a setup where we can ping to Google but not to Facebook. It’s a way how we can do this kind of setup and can visit only a few sites.

Moving ahead to the implementation part:

STEP 1: Check the rules available in the routing table

Command to check the rules in the routing table

To check the rules present in the routing table, we use the command route -n. Here we have a rule in the very first row “0.0.0.0" that allows us to access or ping any site, so to restrict the connectivity to Facebook we will delete this rule in the next step.

Delete a rule

STEP 2: Check the network name for Google and Facebook

Network name

To check the network name we use the command nslookup domain_name.

STEP 3: Check connectivity to the network

Connectivity check

To check the connectivity we will use the address which we get from the last step and ping it.

STEP 4: Add a rule to connect to Google

Adding rule

To add a rule to connect to Google we will use the command route add -net 216.58.196.0 netmask 255.255.255.0 gw 192.168.43.1 enp0s8

STEP 5: Check the connectivity to Google

Connected to Google

Connected successfully to Google.

STEP 6: Check the connectivity to Facebook

Not connected to Facebook

Not connected to Facebook.

So the setup is done. In the same manner, we can add specific rules in the routing table.

Hope this blog helped you to learn some interesting networking tricks.

--

--