Creating a Customized Network Topology using Subnetting
What is a network topology?
Network topology refers to how various nodes, devices, and connections on your network are physically or logically arranged in relation to each other. Think of your network as a city, and the topology as the road map. Just as there are many ways to arrange and maintain a city — such as making sure the avenues and boulevards can facilitate passage between the parts of town getting the most traffic — there are several ways to arrange a network. Each has advantages and disadvantages and depending on the needs of your company, certain arrangements can give you a greater degree of connectivity and security.
The devices can be connected in a number of ways. Some types of network topology are given below.
But in this blog, we are going to create a customized network topology of 3 systems A, B, and C respectively. Where they all are connected via a switch and system A can ping both system B and system C but system B cannot ping system C.
Pre-requisites: We need 3 systems A, B, C connected via a switch. Here, I am using Virtual Box for the systems and connected them via a switch.
We can easily launch the 3 VM's and then go to the settings option then in Network we can select the option Attached to: Host-only Adapter as shown in the image. This option will create a virtual switch and connect them to the VM.
Now our setup is completed. We can power ON our VM
Here we can see the IP address of System A by this command ifconfig enp0s3
and routing table with route -n
. Here we can see that the destination is 192.168.99.0 that means this system can ping any system that is connected to the same switch as system A.
So we can also ping them with ping <ip address>
command.
Now we can also boot up System B.
Here, we can observe that the destination is 192.168.99.0 which means we can ping to all the systems that come under that subnet and we tested it by pinging System A and it works all fine!!
Now we are going to boot system C.
Now we have launched system C
Here also, the route destination is the same which means we can ping all the devices under that subnet but here we need system C to only be able to ping to system A, not system B therefore, we can add our customized route.
route del -net 192.168.99.0 netmask 255.255.255.0 enp0s3
This command will delete the default route. But we also need system C to be able to ping to system A. Hence, we need to add a route that will help us achieve that.
route add -net 192.168.99.103 netmask 255.255.255.255 enp0s3
Now, we can observe that we can ping system A but not system B.
By this, we are able to make a customized network topology where system A can ping both system B and system C but system B cannot ping system C. This is achieved only by the manipulation of the routing table.
Hope you find this article useful
Thanks for reading!!