Network topology where system A can ping to both system B and C but system B can’t ping to system C.

For creating my own LAN network I am changing network setting to host only for all 3 virtual machines.

Like above setting we have attached Host-only adapter network to all VMs.

Consider I am having these 3 VMs having IP addresses 192.168.56.102, 192.168.56.104 and 192.168.56.105

System A — 192.168.56.102
System B — 192.168.56.104
System C — 192.168.56.105

I changed The IP address of my ‘A’ system (192.168.56.102) to 192.168.1.3 using command:

#ifconfig enp0s3 192.168.1.3/29

System A

I changed The IP address of my ‘B’ system (192.168.56.104) to 192.168.1.4 using command and gave subnetmask as 255.255.255.248:

System B

I changed The IP address of my ‘C’ system (192.168.56.105) to 192.168.1.5 using command and gave subnetmask as 255.255.255.248:

System C

Routing tables for A, B, C are:

System A is able to ping system B and system C due to this rule in all A, B, C:

System A is able to ping system B and C.

That means system B and system C is also pinging to system A:

system B is able to ping system A
system C is able to ping system A

But because of the rule in routing table I can also ping to system C through system B which I don’t want.

system B is pinging to system C which I don’t want

So, for avoiding pinging between system B and system C, I will delete rule in routing table of B as well as C by using command:

#route del -net 192.168.1.0 netmask 255.255.255.248 enp0s3

rule deleted from system B
rule deleted from system C

Now, I have created new rule in system B routing table so that system B can connect to system A but not C using command:

#route add -net 192.168.1.0 netmask 255.255.255.252 enp0s3

also rule created in system C routing table so that system C can connect to system A but not B using command:

#route add -net 192.168.1.0 netmask 255.255.255.252 enp0s3

  1. So, finally pinging form system A to B is possible:

that’s why pinging from system B to system A is also possible:

2. Pinging from system A to C is possible:

that’s why pinging from system C to system A is also possible:

3. But the IMPORTANT thing that pinging from system B to system C should be restricted. This condition we achieved here:

System B unable to ping system C but can ping to A.
System C unable to connect B but can ping to A

_________________________________________________________________

Now, system A can connect to system B and C but system B cannot connect to C.

I hope you find this insightful :)

Thank you !!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store