Twisting the routing table so that you can only ping google from your system

Yashraj Panda
4 min readMar 9, 2021

--

Here I’m creating a setup that can ping GOOGLE but not able to ping FACEBOOK or any other sites from same system. But before starting let’s learn about Routing, Routing table, IP address and Gateway.

What is Routing?

Network routing is the process of selecting a path across one or more networks. The principles of routing can apply to any type of network, from telephone networks to public transportation. In packet-switching networks, such as the Internet, routing selects the paths for Internet Protocol (IP) packets to travel from their origin to their destination. These Internet routing decisions are made by specialized pieces of network hardware called routers.

What is 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 (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables. See below a Routing Table:

Destination      Subnet mask         Interface
128.75.43.0 255.255.255.0 Eth0
128.75.43.0 255.255.255.128 Eth1
192.12.17.5 255.255.255.255 Eth3
default Eth2

The entry corresponding to the default gateway configuration is a network destination of 0.0.0.0 with a network mask (netmask) of 0.0.0.0. The Subnet Mask of default route is always 255.255.255.255 .

What is an IP address?

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for “Internet Protocol,” which is the set of rules governing the format of data sent via the internet or local network.

In essence, IP addresses are the identifier that allows information to be sent between devices on a network: they contain location information and make devices accessible for communication. The internet needs a way to differentiate between different computers, routers, and websites. IP addresses provide a way of doing so and form an essential part of how the internet works.

What is Internet Gateway?

An Internet gateway is a network “node” that connects two different networks that use different protocols (rules) for communicating. In the most basic terms, an Internet gateway is where data stops on its way to or from other networks.

Gateways can take several different forms from hardware to software including routers and computers and can perform a variety of tasks. These can range from passing traffic to the next ‘hop’ on its path to filtering traffic, proxies, or protocol translations. Because gateways are, by definition, at the edge of a network, they are often combined with firewalls, which keep out unwanted traffic or ‘foreign’ computers from a closed network.

Now that we are familiar with some terms that we are going to use in our task, let’s start our task

  1. Check the IP address and Netmask of the system.

2. Now ping “www.google.com” as well as “www.facebook.com” to see if you can ping both sites before we make any changes in our routing table.

3. Use the “nslookup” command and get the ip of google so that we can use it later.

4. You can see in above image we can ping both the sites, so now we will delete the Internet gateway for all IP’s of our system.

5. Then add rule in routing table according to google’s ip that we fetched above so that google’s ip will come in the range and than we will add internet gateway for it.

6. Now that we have edited the Routing table, check whether we can ping “www.google.com” and “www.facebook.com”.

7. On the above image you can see that we are able to ping google but not Facebook. This happened because the IP range of Facebook severs are different than that of Google’s . And we have not given any rule in routing table for the range of Facebook servers.

Thank you for reading!!!

--

--

Yashraj Panda

A B.tech undergrad, enthusiastic towards learning new technologies in the market and integrate the technologies with each other.