Setup in which A can ping to B and C but B and C can’t ping each other

Task Description:

Create a network Topology Setup in such a way so that System A can ping to two Systems System B and System C but both these systems should not be pinging each other without using any security rule e.g firewall etc .

To do this I am using VM(Virtual Machine) on Oracle Virtual Box and using RHEL8 in VM’s

Launch 3 VM’s , go to settings -> network -> select host-only adapter (it will work as a switch)

Step 1: Setting IP of system A and adding routing rule

To give IP use ifconfig command

We have to give IP to system A such that it will come in range of routing rule of system B and C

To see routing table use route -n command, to add routing rule use

route add command

We have to add routing rule such that IP of B and C come in range of that rule

I am giving IP 192.168.2.1 to system A and I have added routing rule 192.168.2.0 netmask 255.255.255.248

Step 2: Setting IP of system B and adding routing rule

We have to give IP to system B such that it comes in range of routing rule of A but not of C

We have to add routing rule such that A comes in range of this rule but C doesn’t come in this range

I am giving IP 192.168.2.5 to system B and I have added routing rule 192.168.2.0 netmask 255.255.255.252

Step 3: Setting IP of system C and adding routing rule

We have to give IP to system C such that it comes in range of routing rule of A but not of B

We have to add routing rule such that A comes in range of this rule but B doesn’t come in this range

I am giving IP 192.168.2.6 to system C and I have added routing rule 192.168.2.0 netmask 255.255.255.252

Here we can see that system A can ping to systems B and C but system B can’t ping to system C