Latest Updates

understand core networking: route table

we know that with the help of the internet, we can visit any website or anywhere in the world, without any interruption, and behind the scene, we don’t know what is happening while accessing a website. So, In this article, I would be breaking down the concept behind networking how connectivity is done.

Before knowing how to route table help us for connectivity we should know about basic terminologies in networking

  • Router: A 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.
  • Routing tables: Routing tables are like a data table maintained by a computer that lays down the rules about connecting to different systems or networks.
  • 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

To get a Better Understanding of how the routing table works. Please go through the following demo on the routing tables

Task Objective: -

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


Let’s Get Start

First of all, I will show I have proper connectivity in the system and I am able to connect all the websites in the world from my system.



Note: Pinging or connection always happens from both side that means from client to server and server to client

We can’t directly connect to any IP or any website. Whenever we ping to any IP our network program will first check the routing table whether the entered IP belongs to my network range or not and this network range is typically known as netmask.

if the specific network does not come under the range of any route table rules so the system will not generate a packet for that.

so from here, we got to know that packet creation depends on route tables. the system always refers to route tables for packet creation 

 Now, according to the objective, we have to create such a setup that will connect us with google but it could not able to connect us with Facebook or any other site. 

Step 1. remove your Route where you have given your GateWay

As a result, you will be lost your connectivity with the internet

This is our gateway


Use the following command to remove the route which provides a gateway

route del -net 0.0.0.0 netmask 0.0.0.0

So you can see we lost our connectivity with the internet



Step 2. according to the condition we should able to connect or ping to google

So for this, we will add a specific route that will help us to connect with google only

to do this we need to find out the network range of the google search engine then we will add it to our route table so ultimately we will get connectivity to google only

Google has a lot of servers so we can not find all the ranges so we will pick one of the ranges of google search engine you need to run the following command in your Linux distro.

if you ping google you will get one of the IP of google search engine and by IP you can guess one of the ranges of google that coming to your system

use the following command to ping google

ping www.google.com



you will get to know one of the IP of google that responding you based on that you can guess one of the networks of google

I got this IP “216.58.197.36”

so network I guess would be this “216.58.0.0

Now, we will add this network in our route table with gateway so we will get only connectivity for google, not for Facebook or any other website from our system

Use the following command to add this specific route to the routing table which is in your system

route add -net 216.58.0.0 netmask 255.255.0.0 gw "your gateway"





Finally,

If you search for google in the browser you will be connected to google but if you search Facebook or any other website you will get an error that the server is unreachable


Note: if you search another website you will not get any response from their servers as well

Conclusion :

Without using any kind of firewall or third-party application we able to restrict our system up to specific sites on the internet by only using the concept of the routing table.

So here we broke a very myth that is having internet access allows us to connect to any website on the internet. This is not completely the case. Since today we had internet connectivity at all times yet we were unable to ping to the server until we configured the routing table.

we observed that routing table is a very powerful and important topic in networking hope this is helpful to you


No comments