Working with TCP/IP Networks

In my previous blog article I gave a couple of troubleshooting tips on DHCP. I also mentioned that I would show a trick for working out TCP/IP subnets.

There are MANY subnet calculators out there and they are very useful for planning and designing a TCP/IP infrastructure but sometimes you may just want to know how to work out if two machines are on the same subnet.

Take the following IP Address and subnet mask:

From the above example it's nice and easy to see that the network the IP address lives on is - The dividing line between network and host is obvious and clean.

Now try the same with the following:

Which network does the IP reside on?
The answer is

This can be worked out nice and simply by launching calc in scientific mode and performing an AND operation on the value where the subnet is NOT 255 and NOT 0.

Take these three examples:

What's the subnet mask?

As 255 uses 8 bits for the subnet mask we can work out that it's 255.255 and the something has 4 bits left over. 11110000 equals 128+64+32+16 which is 240 so the subnet mask is:

Now perform the AND function on the 224 octet and you get:
30 AND 240 = 16
31 AND 240 = 16
32 AND 240 = 32

These show that the first two IP address are on the and that the last one is on the network. The last IP addres will need a gateway in order to talk back to the first two.

This tip is really meant for the sort of situations where you have problems with two machines talking to each other. It's a 'sanity check' that lets you see if both machines are on the same or different VLANs.

If you want something that can give you a whole lot more then you can download a really nice free subnet calculator

Author image
IT Person | Veeam Vanguard | VMware vExpert | Windows admin | Docker fan | Spiceworks moderator | keeper of 3 cats | Avid Tea fan