Core Networking concepts

Anirudh Bambhania
3 min readDec 12, 2020

In this article i will show that by changing some rules in your routing table how you would be able to connect to google but at the same time won’t be able to connect to facebook.

For this practical i will be using RedHat linux 8 and to check the connectivity we can use the ping command, so let’s get started.

ifconfig command will tell us about the Ip address of our system. Ping command is used to check the connectivity of our system, below we can see that i was able to ping google and facebook. As we ping our system sent the packet’s to the google and facebook and in reply the we received the packet’s.

Now as we know that we can’t directly connect to the IP that are not in our network, if we want to connect to the IP that is present in different network than we require a device called Router. Every system has a routing table where certain rules are written about the networking, in RedHat we can sue “ “route -n” command to see the routing table

Here we can see that the first rule says that, if i want to connect to any IP than i have to use a gateway 10.0.2.1 which is the router IP, because of this rule i was able to ping both google and facebook. Now let’s create our own rule in routing table, for this we require the IP address of google and facebook which we already have when we used the ping command

To create a rule in routing use the command

route add -net 142.250.62.0 netmask 255.255.255.0 gw 10.0.2.1 enp0s3

here 142.250.62.0 is the network name , and 255.255.255.0 is the netmask means we can connect to any IP which has the same network name, and to connect to different IP we have to provide gateway or say router IP which in my case 10.0.2.1. This will add a new rule in the routing table, but we still have the 0.0.0.0 rule through which we can connect to any IP, so let’s delete that rule and for this we can use

route del -net 0.0.0.0

Now we have the setup ready, so let’s check if we are able to ping to google and facebook or not…

As we can see that we are able to ping to google but we are not able to ping facebook.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Thank You

Anirudh Bambhania

--

--