A setup where you can ping to Google but not to Facebook.

Adarsh Saxena
Mar 14 · 2 min read

What is Routing?

Routing is a mechanism that allows a system to find the network path to another system. A routing table is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes.

Switch to the practical part

First, let’s print the routing table in our Linux OS:

route -n
route -n

Here (in the image above), you can see that the gateway is configured already and the OS connected to the internet. To check if our OS is connected or not, we can ping to Google.com

ping google.com
ping google.com

In the above image, you can see that our system is working perfectly fine and it is able to ping Google.com. Similarly, let’s ping to facebook.com to see if it can ping to facebook.com or not.

ping facebook.com
ping facebook.com

Now, everything is fine and working as expected.

Firstly, we’re going to delete the default gateway from the routing table.

route del -net 0.0.0.0

Now, one record of the routing table is deleted successfully.

Now, we’ll add one rule in the routing table through which it can ping to google.com only.

route add -net 157.240.23.35/24 gw 192.168.42.57

Conclusion

We’ve configured our system (Linux OS) such that it can ping to google.com but not facebook.com by doing some modifications in the routing table.

Cheers to reading!

EntwicklersX

Coming forward for a reason

EntwicklersX

Entwicklers is a community of Programming, Automation, Cloud Computing, Administrators, Security geeks from all around the corners. We strive to bridge the gap between industry and academia.

Adarsh Saxena

Written by

Hey Everone, I am DevOps Practitioner, Cloud Computing, BigData, Machine Learning are my favorite parts. Connect me on LinkedIn to know more about me.

EntwicklersX

Entwicklers is a community of Programming, Automation, Cloud Computing, Administrators, Security geeks from all around the corners. We strive to bridge the gap between industry and academia.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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