A NetWork SetUp That Can Ping Google But Not Able To Ping Facebook From Same System.

Tribhuban Mishra
5 min readMar 13, 2021

In this article , we are going to see the concept behind the networking and I would be creating a network from which we can ping to google but not to Facebook.This network setup can be easily achieved by manipulating the routing table.

Lets understand the basic terminologies of networking which helps you to understand this practical easily :

  • Switch: Switch is a component that allows a system to connect to a different computer in the same network.
  • Router: Router is a component in the computer or a separate device that allows a system to connect to a different system of a different network.
  • Data Packet: Whenever we are pinging to different machines our system creates a packet. If the connection is not allowed by the rules of the routing table then this packet is not created.
  • Gateway: The gateway is the place in the network from which the computer connects to the internet or some other network. Without knowing the gateway it is not possible for the system to connect to the internet.
  • Network Card: A network card is a hardware component of the computer that connects a computer to a computer network.
  • Routing 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 network will be directed. A routing table contains the information necessary to forward a packet along the best path toward its destination.
  • 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. For example, in 255.255.225.0, “0” is the assigned network address. In 255.255.255.255, “255” is the assigned broadcast address.The 0 and 255 are always assigned and cannot be used. or in simple words we can say that the Netmask is the only one which decides the network name of particular IP.

Platform Used : RHEL8

To understand it more clearly Let’s Start with the Practical :

Checking the ip of system

Command : ifconfig

The Ip of our System is 192.168.29.138 And Netmask of our system is 255.255.255.0 or /24 prefix length. Here, the Netmask tells the network name that is 192.168.29.0 . The Total number of host ip that can connect with this network is 0–255 i.e. 256 ,but the first and last IP is reserved for network name and broadcast address respectively.

To View the routing Table

Command : route -n

So here we can see our routing table.In this route table our Network card enp0s3 have two rules one belongs to our netmask 192.168.29.0 and the other one 0.0.0.0 is the default gateway configuration having network destination of 0.0.0.0 with a netmask of 0.0.0.0 which is used to connect all the destination IP’s available on the internet by using the gateway 192.168.29.1.

This gateway IP comes from hotspot connectivity. Hotspot internally works as Gateway here.

Now by using this default available rule 0.0.0.0 we are able to ping Google, Facebook.

Command : ping www.google.com

Command : ping www.facebook.com

Now we are going to delete this default rule 0.0.0.0 . After deleting the routing table rule , I can’t connect to any of the IP.

Command : route del -net 0.0.0.0

Now let’s try to ping Google and Facebook again.

Here you can see that I am not able to ping www.google.com or any other IP as It is showing Network is Unreachable .
So what actually happens when we ping www.google.com our network program will first goes to routing table and check whether that google IP is in my range or not. but I had already deleted the rule for all IPs therefore google’s IP doesn’t come in my range so It will not create any packet.

Here, also you can see that the packets are not created for any IP while pinging just because of the default rule get deleted.

Lets Find the IP of google and add the new rule in routing table.

Command : nslookup www.google.com

The IP of google is 172.217.166.196. and create a new rule using following command and check the routing table :-

Command : route add -net 172.217.166.0 netmask 255.255.255.0 gw 192.168.29.1 enp0s3

Finally, We can ping google but can’t facebook becoz the ip of facebook(69.171.250.35) is not in the range of routing table’s network range.To make www.facebook.com pingable ,we have to write a new rule in routing table.

Using GUI ,I can easily connect to www.google.com .

but not able to connect with www.facebook.com

This is how you can give access to some websites and restrict the rest with the help of routing table.

Thanks for giving your Valuable time…….

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response