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.

This means that there's a much easier way to talk about the split (especially since CIDR). The 255.255.255.0 being shown as 11111111 11111111 11111111 00000000, is a set of 24 1's, so we call this a /24 network.

Going back to the CIDR Classes A,B and C:

Class A: Netmask 255.0.0.011111111 00000000 00000000 00000000 = /8
Class B: Netmask 255.255.0.011111111 11111111 00000000 00000000 = /16
Class C: Netmask 255.255.255.011111111 11111111 11111111 00000000 = /24

However, the "/xx" notation allows us to describe the smaller networks in particular, more easily:

DecimalHex/xx
255.255.255.0ffffff00/24
255.255.255.128ffffff80/25
255.255.255.192ffffffc0/26
255.255.255.224ffffffe0/27
255.255.255.240fffffff0/28
255.255.255.248fffffff8/29
255.255.255.252fffffffc/30
255.255.255.254fffffffe/31
255.255.255.255ffffffff/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.

Networking Tutorial
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon