IPv4 addresses and subnet masks
In the previous section, we discussed IP addresses briefly, but let's discuss them in a bit more detail. What IPv4 allows you to do is to address each device in a subnet uniquely by assigning each device an address and a subnet mask. For instance, in our example the IPv4 address is 192.168.122.182
. Each octet in an IPv4 address can range from 0-255
, and the subnet mask is /24
, which is also commonly represented as 255.255.255.0
. This seems complicated until we break things down to a binary representation. 255
in binary is 11111111
(8 bits), and 3 of those groupings makes 24 bits. So, what our address and mask representation is saying is that, when masked, the network portion of the address is 192.168.122.0
, and the host portion of the address is 182
and can range from 1-254
.
Breaking this down:
What if we needed a larger subnet? We can simply slide that mask over a few bits to the left. For instance, for a 20 bit subnet...