PINGING TO GOOGLE NOT TO FACEBOOK

Rishabh Jain
5 min readFeb 12, 2021

Bonjour! Connections here I am going to show you an amazing network setup where in a system one can ping to the only websites which one wants to have connectivity with and for other the packets will not be generated. In this blog I am going to show you with the example of two most known websites i.e. Google and Facebook in which I will only be able to ping to Google but not to Facebook. It is a very easy and amazing setup by just changing the rules in the Route Table.

Before starting to create the setup let us first become familiar with some technical terms.

Route Table

A routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables.

Routing

Routing is the process of selecting a path for traffic in a network or between or across multiple networks. … Packet forwarding is the transit of network packets from one network interface to another. Intermediate nodes are typically network hardware devices such as routers, gateways, firewalls, or switches.

Ping

Ping (latency is the technically more correct term) means the time it takes for a small data set to be transmitted from your device to a server on the Internet and back to your device again. The ping time is measured in milliseconds (ms).

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.

Routers

A router receives and sends data on computer networks. Routers are sometimes confused with network hubs, modems, or network switches. However, routers can combine the functions of these components, and connect with these devices, to improve Internet access or help create business networks.

NetMask

A netmask is a 32-bit binary mask used to divide an IP address into subnets and specify the network’s available hosts. … 225.0, “0” is the assigned network address. In 255.255. 255.255, the final “255” is the assigned broadcast address. These two values cannot be used for IP address assignment.

Network Card

A Network interface card (also known as a NIC, network card, or network interface controller) is an electronic device that connects a computer to a computer network, usually a LAN. It is considered a piece of computer hardware. … To achieve the connection, network cards use a suitable protocol, for example CSMA/CD.

So, now let us move on building the setup.

PREREQUISITES

  1. Red Hat Linux 8 installed and running
  2. Internet Connectivity.

First of all check the routes in the Routing Table by the command shown below.

After this you can see different routes mentioned in the table and because of the first rule 0.0.0.0 in the table one can ping to any network in the world.

For testing this we can ping to the IP of Google and Facebook as shown below.

To know the IP of any domain use nslookup <domain name> as shown below.

To know IP of Google :

To know IP of Facebook :

Now one can check by pinging to the respective IPs as shown below.

Pinging To Google

Pinging To Facebook

Now let us delete the rule by the command shown below.

Now try to ping any IP again (You will not be able to) as shown below.

Pinging To Google

Pinging To Facebook

So, as you all can see that we are not able to ping to any website as we have deleted the rule from the Route Table which clearly tells that if you want to connect to someone you need it to mention as a rule in the Route Table.

Now let us know the IP of gateway we can know it by the command

ip r or ip route as shown below.

To Know the name of your Network Card in PC which actually allows your device to connect with the Outer world or Internet one can use the ifconfig command shown below.

Here in my case I have enp0s3 and enp0s8 are two network card names attached to my system. (The Highlighted One).

Now let us add the rule in the Route Table for only allowing the system to ping to the Google as shown below.

Now one can check the route table which is shown below.

The IP is now added to the route table as highlighted above.

So, finally if one now wants to ping to this IP one can ping it but no other IPs can be Pinged. So, now finally we will be pinging both the IPs and output is shown below.

PING TO GOOGLE:

PING TO FACEBOOOK:

So, one can see that now only IP of Google is Pinged and IP of Facebook or any other IP cannot be pinged or the Packets are not generated for the IP as shown above.

THANKS A LOT!! HOPE YOU LIKED IT.

--

--

Rishabh Jain

I am a tech enthusiast, researcher and an integration seeker. I love to explore and learn about the right technology and right concepts from its foundation.