3. Subnet Math

Lesson Content

Ok, we know that subnet masks are important to figure out how many hosts we can have on our subnet. So how many hosts would that be?

Let’s say I have an IP address of 192.168.1.0 and a subnet mask of 255.255.255.0, now let’s line up these numbers in binary form. For now use an online calculator to convert these values from decimal to binary.

192.168.1.165  = 11000000.10101000.00000001.10100101
255.255.255.0  = 11111111.11111111.11111111.00000000

The IP address is masked by our subnet mask, when you see a 1, it is masked and we pretend like we don’t see it. So the only possible hosts we can have are from the 00000000 region. Remember 11111111 in binary form equals 255, we also account 0 as a host number, so there are 256 possible options. However, it may look like we have 256 possible options, but we actually subtract 2 hosts because we have to account for the broadcast address and the subnet address, leaving us with 254 possible hosts on our subnet. So we know that we can have hosts with IP addresses ranging from 192.168.1.1 - 192.168.1.254.

Exercise

No exercises for this lesson.

Quiz Question

# What is the binary equivalent of 255? > - Divide 255 by 2. Use the integer quotient obtained in this step as the dividend for the next step. Repeat the process until the quotient becomes 0. Write the remainder from bottom to top i.e. in the reverse chronological order. This will give the binary equivalent of 255. > - | Devidend | Remainder | |:-----------:|:---------:| | 255/2 = 127 | 1 | | 127/2 = 63 | 1 | | 63/2 = 31 | 1 | | 31/2 = 15 | 1 | | 15/2 = 7 | 1 | | 7/2 = 3 | 1 | | 3/2 = 1 | 1 | | 1/2 = 0 | 1 | 1. [ ] 00000000 2. [ ] 11101101 3. [ ] 01010101 4. [x] 11111111