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

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

Task Description

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

For performing the above task,we need to work on the rules present the route table. The packets are only generated according to the rules in the route table.

Let's proceed with the task.

STEP 1 : Start the system. I have used the system with the IP shown below:

No alt text provided for this image

STEP 2 : Check the route table using the command "route -n". Also check whether we are able to ping both google and facebook initially or not using "ping" command.

No alt text provided for this image

Successfully ping google:

No alt text provided for this image

Successfully ping facebook:

No alt text provided for this image

STEP 3 : Create a rule using IP, netmask, and gateway by which we are able to ping only google and not Facebook using the command "route add"

But before that we have to remove a Universal IP 0.0.0.0 from the routing table using the command "route del -net 0.0.0.0". Refer below the rule for the 0.0.0.0 IP has been deleted:

No alt text provided for this image

Now let's create rule by which we can ping only google and not facebook. The command used : route add -net 172.217.160.0 netmask 255.255.255.0 gw 192.168.0.1 enp0s3

No alt text provided for this image

STEP 4: We are done. Let's check whether the objective of the task is achieved or not.

PING Google using ping command: It's successful.

No alt text provided for this image

PING Facebook using ping command : Failed!! Getting error "no route"

No alt text provided for this image

We can see from the above images that we are able to ping google because we created a rule for it in the routing table but not facebook. The reason is the packets are only generated based on the rule of routing table. We don't have any rule for facebook so we can not ping facebook.

DONE !!

Hope you found this article interesting.

Manish kumar Singh

Sr. DevOps Engineer @Mindbowser | 1x AWS | CKA, CKAD , DO180 , RHCSA, RH294 Trained | DevSecOps | KOps | GitOps | DevOps

4 年

Well done ?? Jasprit Kaur

回复

要查看或添加评论,请登录

Jasprit Kaur的更多文章

社区洞察

其他会员也浏览了