# calculating subnet mask from ip addresses [duplicate]

suppose I have three ip addresses

A:172.16.1.1
B:172.16.2.1
C:172.16.3.1

Now, If I want to put B and C in the same network and A in a different network, which subnet mask will i have to use? how will I calculate it?

• Do your home work on your own
– user2084
Dec 15, 2015 at 7:49

## 1 Answer

• 172.16.1.0/24 for A
• 172.16.2.0/23 for B and C

This question will tell you how to calculate it.

IP Address 10.10.15.10/16

Step 1) Translate the IP address 4 octets into binary:

00001010.00001010.00001111.00001010

Step 2) Translate the Subnet mask 4 octets into binary, which is easy using CIDR:

11111111.11111111.00000000.00000000

Step 3) Perform the AND operation on the two addresses. This will give you the Network Address for the subnet. AND rules are:

1 AND 1 = 1, O AND 1 = 0, 0 AND 0 = 0, 1 AND 0 = 0

00001010.00001010.00001111.00001010
11111111.11111111.00000000.00000000
===================================
00001010.00001010.00000000.00000000

Step 4) Convert it back to decimal:

10.10.0.0