understand core networking: route table
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_GKowLhuh5tHglSFi0EmORGp1IwXKouW2L2-v8YfPAUAh7MhNVVpCrH7Kr_orbQVrBy5vEf3mZY-Sbb82yTR6RFNLc6Aa-fiD0CFvps7rALob5yDsD6usPfY_UW95qD9QnkaZLUg47X4/s16000/1_jfW_8TcEcpRfcTrruupnng.jpeg)
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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJopcb8TfGMp8lmLfAwgF2HNGobk8XHUO9RR4BdOtj27dlpp42NXz2doUFl2Dg4ww4vFypVXNAYFagzG7QnHhq6HnYw7cOQ8n95fBHF7ZG7qnMe6LlXOKmc7u-x1BklcJp11-pcOKdtF0/s16000/1_B1eZVl6iH0nwuBXr5OORrg+%25281%2529.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF0vx3Hcs4H1a6w54cCrQNtnTiYCJc96x2CdaAlYP_TrS2W0merABAqjCKf4yRvPDfOd4dxq_yZQQOYLbG1waUgA_6e_RACnnKaGP1bHAA3NuoVOMoRXBm-9W4FAxBcH3ZE8tx58oS0tQ/s16000/1_jkmqU2TuBXF4s6untNVUyw.png)
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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt_RhD0tmE6aUf4SF5lQ86Sq9n-U4SKhUkGH34E3e4E7GCxtJSb_YRdL_ohJ6Qad7uQLj_4z9WmaTg7a9euDj977nPUmPxPQPUDQqgpVKYpwD9eo7m_VDIFtfX7yHP2CpHJxzhkjJeuyQ/s16000/1_GnQ1d3bVPXtOvmplPPnrcQ.png)
route del -net 0.0.0.0 netmask 0.0.0.0
So you can see we lost our connectivity with the internet
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8-eU_k5pya2SdFAM6ZR6phagciDz7RXlNqmNvOggcjXaAhdjRVBdfiGjzWq853HmWb2lErTMNMgCcvyaf8gfo6zk0yjR7Xyvn9yfA1htVsHlUGMqnoEf3xPkEgKVzwc418MkkVjcdwl8/s16000/1_CFxqAeM0beJfZaqWcTpbrg.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoCVkwkxbuy75fYOUc3wCysyKmMh_cRsLEaGlqX6F36qjogdCT8iKWTjQVXDWGJPfNPOIjcLIO3JBQIz4NEhQUhy1cmQSrTHO1gCwVtkVM7dXH621M0QNSGAyj-LUPWJSDwcvT1R4Pvjw/s16000/1_bkC9bXOZYgnXPRNcVmuamA.png)
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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkdzQo208OhP9-IsM3xqwbF8ES-NZR-THZCj7szrhPb0f0GmrTgdH1gKqda7PUGPhyhgl0mj2nmUf5izzyMTyDGTCcWlHoUpQ6lM_6K9P3bO0Za6kCZIKOjr2SpkUTVJ3ZuU0T7ywl2HA/s16000/1_B1eZVl6iH0nwuBXr5OORrg+%25281%2529.png)
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
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqeTVBjpu9z2Oa1NQrc7mQcJc0wqpxy9zfqMNvLeHYc4jt88xSN95jwVTlzJKhM8NIDzfEePK8j_2yWO0eaCPsIYag16-Ode21R2q2stnBchO-TQXHHScFHe3qWUjFmWLwnseUQxgxvgQ/s16000/1_q-cA9ArReiefFViBANw-tw.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFUtL6LFe2BrrxuvPeWGU7MUgHwHR6nKwTJPq1gOOZCUKEtXamxgmPjh4SIksQlx6LpCcUuy1E8Y7psPhhW_VR6O54VqQhUOvAoiiNcZ6uqXA6I-hKKr_lZNmxRZvGo5VKlaQ6-JZNt9E/s16000/1_UYtx4KSGhX41FonAZUBwLg.png)
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