Netmask : The /xx notation
You might want to read Bases for more about base 2 and base 16 before reading this.
Traditionally, networks have been described by their netmask in decimal notation - that is, one would say:
This is the 192.168.1.0 / 255.255.255.0 network
or possibly as hex:
This is the 192.168.1.0 / ffffff00 network
This is particularly useful because it is nice and specific. In real life, we don't need to get particularly specific. We could have a netmask of, say, 192.168.1.0/255.255.255.2. This would mean that there are two 192.168.1.x networks, one with odd-numbered hosts, the other with even-numbered hosts.
This gives no real benefit, so in real life, any netmask, when represented
in binary, tends to look like this:
11111111 11111111 11111111 00000000
By contrast, the 255.255.255.2 netmask, would look like this:
11111111 11111111 11111111 00000010
The former has a bunch of 24 1's followed by 8 0's. The latter isn't as simple, but as I said, we never do this in real life. Networks are always divided into so-much-is-network-and-the-rest-is-host.
Going back to the CIDR Classes A,B and C:
Class A: Netmask 255.0.0.0 | 11111111 00000000 00000000 00000000 = /8 |
---|---|
Class B: Netmask 255.255.0.0 | 11111111 11111111 00000000 00000000 = /16 |
Class C: Netmask 255.255.255.0 | 11111111 11111111 11111111 00000000 = /24 |
However, the "/xx" notation allows us to describe the smaller networks in particular, more easily:
Decimal | Hex | /xx |
---|---|---|
255.255.255.0 | ffffff00 | /24 |
255.255.255.128 | ffffff80 | /25 |
255.255.255.192 | ffffffc0 | /26 |
255.255.255.224 | ffffffe0 | /27 |
255.255.255.240 | fffffff0 | /28 |
255.255.255.248 | fffffff8 | /29 |
255.255.255.252 | fffffffc | /30 |
255.255.255.254 | fffffffe | /31 |
255.255.255.255 | ffffffff | /32 |
So as the /xx increases, the netmask decreases. The "xx" simply denotes how many bits (again, refer to the Bases page to understand how base 10, base 2 and base 16 correlate) are the network.
Class A is /8; Class B is /16; Class C is /24.
Easy, really :-)
netmask.c is a (BSD-licensed) C program which will convert most formats to most other formats.