Welcome back to my new blog ...In this blog, I am going to show you how to create such setup through which we can connect to only specific websites that you want.
So in this practical, I am going to show you that, I can ping google but not able to ping Facebook from the same system.
Prerequisites:-
Pinging:- It is mostly used to verify the connection with a server of any domain name.
command :- ping host_name/host_IP_address
Whenever we ping to any IP address (destination IP), our network program first checks the routing tables, to find out that the IP we are pinging comes inside our network range or not. If that IP doesn’t belong to the same Network Range, then our system will not generate packets, As it will not create any packet, so it will not ping.
What is routing table.?
The routing table contains a list of specific routing destinations or we can say that the list of rules. When the router receives a packet of data, it references the routing table to know where to send that data.
So now let's jump to the practical part:-
First, I am going to show you my routing table.
Command: route -n
Here you can see that there is one rule 0.0.0.0, this rule is by default available, due to this rule we can ping any server /IP over the internet. Now I am going to show you that I can ping google.com as well as facebook.com
Here u can see that I can ping both google.com as well as facebook.com, let check it through GUI also ...
As I told you above due to that rule, I can ping any server over the internet, So now I am going to delete that rule.
How to delete?
command :- route del -net 0.0.0.0
Here now you can see that rule is deleted, so now I am going to ping google.com as well as facebook.com, Let's see what happen....
Due to deleted that rule, So now when I am going to ping google.com and facebook.com, it shows that the network is unreachable and also you can see the GUI part that we are not able to connect that server.
Now I am going to add 1 rule through which we can connect to only google.com but for adding rule we have to first know what is IP
Command to find IP :- nslookup google.com
From the above figure, you can see that the IP of google (142.250.67.174)
Now I m going to add a rule.
commad :- route add -net 142.250.67.0 netmask 255.255.255.0 gw 192.168.43.1 enp0s3
In the routing table I am going to add a rule of a network for network id in a range from (142.250.67.0, 142.250.67.1, ...................142.250.67.0 .255 ) using my gateway: 192.168.43.1 via enp0s3 network card so by adding this rule I can ping any server /IP which lies between this range.
Here you can see that the 1 rule is added so now I am going to ping google as well as Facebook, let's see what happen
As you can see here now I can ping google.com but not able to ping facebook.com because in our routing table there is no rule for Facebook. As facebook comes under another network range that's why we are not able to connect Facebook server.
So in this way you can add as many as rules you want.
Comments