CREATE A SETUP SUCH THAT WE CAN PING TO GOOGLE BUT NOT FACEBOOK AT THE SAME TIME

Task Description

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

In Networking, if we want to connect to any system in outside world, then we require their IP/Hostname, Port no. and your system should have one rule written in your Routing Table so that your system can send packets to that server/website. Without this rule we can’t send packets to outside world and hence connection is not possible. In our system/device, there is one by default rule created in Routing Table using which we can connect to any server in the outside world called as 0.0.0.0. It means you can connect to any specific IP of the world as Destination IP. But, in our task we have such requirement that our system should ping/connect to Google but not able to connect to Facebook. You can refer below video to do so.

> In above video, We have first check our connectivity with both Google and Facebook. As I have use RHEL8 Linux in this video , we have one command called ->

route -n

This command will show us the routing table of our OS. Now you will see one rule for 0.0.0.0 using which you can connect with outside world. Thus, according to our requirement we will have to delete this rule and for doing this use command->

route del -net 0.0.0.0

Now, we don’t have any connectivity with the outside world. Now, we will add one rule such that our OS will be able to ping to Google but will not be able to connect to Facebook and for doing this use command->

route add -net 142.250.183.0 netmask 255.255.255.0 enp0s3

In this command, “ 142.250.183.0” is network name of Google in my case and then we have to specify the netmask and name of our NIC card.

Now, if you try you can ping to google but can’t Facebook.

THANK YOU FOR READING!!

THANKS A LOT VIMAL DAGA SIR FOR EXPLAINING SUCH A GREAT CONCEPT.

--

--

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