Networking: Routing Table Manipulation | DNS Spoofing

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

Solution: to do so there are multiple ways in which we can manipulate our device such that it can ping/connect everything except Facebook, or just be able to connect to google. Today we are going to cover two such ways of completing our task… The following are the methods I used to achieve the goal:

  1. Through Manipulation of the routing table.
  2. DNS spoofing locally using the internal hosts.

The How> To connect two places via computer networking the basic requirements are as follows:

  1. OS and a device to run the OS on both the side, i.e. a computer with an OS of choice, in our case the two devices are the client (us with our computer) and the server computer (Google/Facebook and their server systems) and the OS of my choice for this task is RHEL8.
  2. NIC, which I assume you will have as you are using the internet, same applies to them(Google/Facebook).
  3. Internet Protocol, i.e. a set of agreed upon rules for communication between two parties. We are going to use IPv4 for our operation.
  4. A connection on the physical layer via cables, routers, switches etc. between us and them(Google/Facebook).
  5. Us and them(Google/Facebook) must be in a single network.

Point 4 and 5 can be achieved with the help of an internet provider.

6. IP addresses. Since our operation is taking place on the internet, we will use the public IP. This on our end will be done automatically through SNAT(Source Network Address Translation). And on their end again they’ll take care of making their public IP translate to a private one.

Now to disrupt the connection between us and them(Facebook) we can manipulate any of the required block.

Solution 1.) By manipulating the routing table we’ll be able to create a disconnect the network between the two parties. This is done by making our gateway disallowing the connection hence this will disrupt physical connection.

Routing Table: a table used to store routes for a network/network range destination in router or network host.

Routing table and initial ping test

The above snippet shows(under the heading ‘kernel IP routing table’) that we are connecting to the internet( through a Gateway with IP and the Genmask as i.e. the prefix length=0 and the interface(Iface) for this is enp0s3 . Also further below we had successful pings with both and as both the pings had 0% packet loss for whatever number of packets the ping was ran.

Now through some research I found out that most of the Facebook’s public IP addresses are in the range of–!) i.e. rejecting the connection for all the IPs in this range will result in a connection failure for Facebook. Now to do this we can either delete the path and add all the paths except–, but for this we require a lot of calculation that too in binary⊙﹏⊙∥. So instead we can use another way to do this is through reject option in route add command.

mentioned command with the result in routing table.

Hence we can add reject for any range or a single host destination, and the result is a reject rule added in our routing table(second rule). The second rule where there is no Gateway or an interface is the rule added by running the command.

Now let’s try pinging…

ping test after adding the reject rule

Hence it is clear that the route for Facebook is rejected, hence we can even try to connect via the browser…

testing with browser after adding the rule

Solution 2.) Since we are using the DNS of Facebook( and Google( for pinging, and hence our DNS is being resolved by some DNS server into an IP before any connection request is sent their way. So we can use another way to disrupting the connection that is by not allowing our system to have the IP addresses of the server.

initial ping test

Note in the snippet above how is being translated to while is translated to . We can create a sort of a DNS poisoning so that wrong IP is the DNS is translated to some wrong IP say . Let’s first check what happens when we ping

100% packet loss

Note the error as Destination Host Unreachable, this is because no such host(host with IP address exists.

Now, to poison our DNS I am going to use a very very simple way, i.e. by providing the wrong IP to the hosts file for the the host name locally i.e. by using the hosts file to create a hostname for And since that file is checked prior to DNS translation, it will create a pseudo DNS poisoning.

The marked is the rule that will disrupt the connection.

Now let’s do a ping test…

The error is same as before

Hence we our connection has failed successfully\(@^0^@)/…

Solution 2 shows us how dangerous DNS poisoning can be as rather than us using non existent IP address, if someone were to create a copy of Facebook on their own system, some user can be phished if they aren’t careful. Hence it is necessary to always to look for https before entering any credentials, as it is much more secure and requires the creation of authentic certificates and certificate checks. However it is very much possible and has become prevalent in recent years. Also entering credentials via an open hotspot or WiFi possess the same threat and is hence highly not recommended.

That’s It…

Task Completed Successfully (⌐■_■)!!!🎉🐱‍🏍✔

Thank you for reading!!!😁 I hope you enjoyed it… You are awesome!!!


Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Eight cybersecurity essentials to safeguard your financial data

How RedRocket works?

ESP32 + AWS IoT And Secured WiFi LEDs

InsurAce Claim Assessments

{UPDATE} Racing Rocket Hack Free Resources Generator

by Joshua Jenster, president VIDT Datalink Awareness Team

A tale of Stored XSS #BugBounty


{UPDATE} Escape Virtual kids room Hack Free Resources Generator

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
Prithviraj Singh

Prithviraj Singh

More from Medium

Ansible troubleshooting — Permission denied Errno 13

Splunk: Sort Command

XMGoat — An Open Source Pentesting Tool for Azure