Here We setup a network topology where our system can connect with Google.com, at the same time can’t connect with Facebook.com
Routing Table, is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes. The routing table contains information about the topology of the network immediately around it.
Netmask is a 32-bit “mask” used to divide an IP address into subnets and specify the network’s available hosts. In a netmask, two bits are always automatically assigned.
The Default Gateway is the path used to pass information when the device doesn’t know where the destination is. More directly, a default gateway is a router that connects your host to remote network segments.
Route Command in Linux is used when you want to work with the IP/kernel routing table. It is mainly used to set up static routes to specific hosts or networks via an interface.
Now, Let’s go to implementation part:
Now, We will check if our system can ping to Google and Facebook before we do any setup initialization:
As here, We can see, Our system can connect with Google as well as Facebook without any problem.
Now, Create one text file where we can put all the information of our ips’ for future reference.
Now, We will delete the Default Gateway of our system:
#route del -net 0.0.0.0
Let’s check if anything is connected even after removing the default gateway
Now, We will add some new rules to Routing Table, So that Network can allow to ping with Google
#route add -net 18.104.22.168/24 gw 192.168.43.1 enp0s3
Let’s try to Ping Google and Facebook :
As we can clearly see, We can ping to Google.com without any problem while We are not able to ping Facebook.com with our System, Hence Our Goal is attained.
We have successfully created A Network Topology Setup where Our System can ping with google but can’t ping with facebook.
For any query or doubt, You can connect with me: