In the university lab, i manually added IP in two ubuntu machines. PC1 IP 10.129.2.33 255.255.0.0 and PC2 IP 10.129.2.165 255.255.255.0. I connected first both computers with direct ethernet cable and later through default lab configuration, where all computers connect to a common switch in lab. I didn't do anything with switch. However, in both cases I was able to ping both machines although having on different subnets. Any idea what could be wrong?
2 Answers
Each PC determines that the other is on the same subnet, so ping succeeds, even though you have different masks.
They are in the overlapping subnets:
$ ipcalc -mnb 10.129.2.33/16
NETMASK=255.255.0.0
BROADCAST=10.129.255.255
NETWORK=10.129.0.0
$ ipcalc -mnb 10.129.2.165/24
NETMASK=255.255.255.0
BROADCAST=10.129.2.255
NETWORK=10.129.2.0
Why shouldn't they see each other? Each host sees the second one within it's own subnet, so the broadcast address doesn't matter (network address is not used on the wire at all) - it sends ARP request to determine it's MAC address and receives response, which is enough for L2 connectivity.