A subnet is defined by a subnet mask, and this can be shown in a number of ways. e.g. 192.168.42.1 with a subnet of 255.255.255.0 means a range of addresses 192.168.42.0 to 192.168.42.255 are all on the same subnet. Where the subnet is only 255s and 0s, this simply means that the part of the IP addresses where there is a 255 must be the same and the part where there is a 0 may be different. So, 192.168.42.1 with subnet 255.255.0.0 is 192.168.0.0 to 192.168.255.255.
A subnet mask is always a number of bits which are common between IPs in the same subnet, and the remainder which can be different. So sometimes this is shown as a bit count. e.g. 192.168.42.1/24 means 24 bits of subnet, or a mask of 255.255.255.0.
Where the subnet mask is not a multiple of 8 (i.e. whole bytes), the mask is more complex, e.g. 192.168.42.1 netmask 255.255.255.240 is 28 bits and gives the range 192.168.42.0 to 192.168.42.15 (i.e. 16 addresses).
So, the same range 192.168.42.0-15 could be entered as 192.168.42.0 to 192.168.42.15, or 192.168.42.0 and 28, or 192.168.42.0 and 255.255.255.240. Note that entering a mask or bit count will make the range start and end at the right point, so the above could be entered as 192.168.42.5 and 28 with the same effect (but 192.168.42.17 would be 192.168.42.16-31 as 17 is in the next block of 16).
When displaying subnet settings, the bit count is shown as well as the actual IP used on the subnet, e.g. 192.168.42.1/28.
Use of common bit counts and subnet masks:
Bit count | Subnet mask | Number of addresses |
8 | 255.0.0.0 | 16,777,216 |
16 | 255.255.0.0 | 65,536 |
17 | 255.255.128.0 | 32,768 |
18 | 255.255.192.0 | 16,384 |
19 | 255.255.224.0 | 8,192 |
20 | 255.255.240.0 | 4,096 |
21 | 255.255.248.0 | 2,048 |
22 | 255.255.252.0 | 1,024 |
23 | 255.255.254.0 | 512 |
24 | 255.255.255.0 | 256 |
25 | 255.255.255.128 | 128 |
26 | 255.255.255.192 | 64 |
27 | 255.255.255.224 | 32 |
28 | 255.255.255.240 | 16 |
29 | 255.255.255.248 | 8 |
30 | 255.255.255.252 | 4 |