TASK13:- Setup To Ping Only a Particular Website Instead of All

but not able to ping Facebook from same system.

Before starting this interesting task , first let’s introduce with some basic terminologies , we will be using in this networking task .

Routing Table:-

A routing table is a set of rules that is used to determine that which rules will network packet follow ,and how they will go .The Routing table contains several information like Destination Network Name , Gateway, Netmask , Network Card Name etc.

NETMASK:-

A Netmask is a 32-bit “mask” used to divide an IP address into subnets and specify the network’s available hosts. In a netmask, two bits are always automatically assigned.

Gateway:-

A gateway is a piece of networking hardware used in telecommunications for telecommunications networks that allows data to flow from one discrete network to another.

What we will be doing :- We will edit our route table in this way that we only can ping to Google but not to Facebook .

First of all open command line and check ip address of system by command ifconfig

now check the route table which is by default provided to our os for networking . use command route -n

now check whether in this default setting we are able to ping google or not . if yes then check its network details. use following commands

ping google.com

nslookup google.com

From here Notice IP, Server and other details

Ping Facebook too to check its connectivity

Facebook is pinging

Now we want to remove the setup so that we will not able to ping any one of them . for that use command

route del -net 0.0.0.0

Now try to ping google and facebook both . you won’t be able to ping them.

Now here the challenge come up . how to ping google .for this add 1 rule to our route table which will tell us that we can ping google with particular ip os that .

for this we need to calculate ip that to be added there . generally we use that ip which we get by ping or nslookup command than we intersect that ip with our netmask and get the ip to put in command .

here we can use 2 things .

  1. we got ip from ping google.com that is 217.160.0.201 . we can intersect it with 255.255.255.0 and will get 217.160.0.0 and now use this in our route table

route add -net 217.160.0.0 netmask 255.255.255.0 gw 192.168.0.1 enp0s3

2. we got ip from nslookup google.com that is172.217.174.238 . we can intersect it with 255.255.255.0 and will get 172.217.174.0 and now use this in our route table

route add -net 172.217.174.0 netmask 255.255.255.0 gw 192.168.0.1 enp0s3

Now try and ping google .You will be able to ping google using both the ips 172.217.174.238 and 217.160.0.201

ping 172.217.174.238
ping 217.160.0.201

As we can see , we are able to ping google but not Facebook .

That’s all with this article. I hope you found the post Informative, if something was missing or you think some more things could have been added, feel free to provide suggestions in the comments section.

You can check out my LinkedIn profile.

--

--

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