# What's 24 in "192.168.15.0/24"?

What's the meaning of /24 in the following command?

• I may be wrong (I haven't used Windows route for a while), but that gateway is from a different subnet. Or is this just a made up example?
– Azz
Apr 14, 2011 at 20:43

It is the short way of representing a subnet mask.

As Steffen Opel points out in his answer, this is called CIDR notation and the number simply indicates the prefix size used to construct the subnet mask.

So /n means that the first n bits (out of 32 for IPv4) are set to 1, the rest are set to 0. To convert this to a decimal subnet mask you write it in to four octet's and convert to decimal.

So /24 produces 255.255.255.0 because you have twenty four 1 bits and then eigth 0 bits:

Binary:   11111111 11111111 11111111 00000000
Decimal:    255      255      255       0

The short value doesn't have to be a multiple of 8 (ie, it doesn't have to end of the octet boundaries), for example you can take /20 to get 255.255.240.0 as so:

Binary:   11111111 11111111 11110000 00000000
Decimal:    255      255      240       0

## Usage with IPv6

The same notation can be appiled to IPv6 as well. Since IPv6 uses 128 bits, instead of 32, the addresses are much larger. I won't go in to the full semantics here, because it's not relevant to the question, but will provide a quick example:

The subnet given in the question is represented by 192.168.15.0/24 and includes all the IPv4 addresses from 192.168.15.0 to 192.168.15.255

An IPv6 subnet can be represented in the same way, for example 2001:DB8::/48 contains all IPv6 addresses in the range 2001:DB8:0:0:0:0:0:0 to 2001:DB8:0:FFFF:FFFF:FFFF:FFFF:FFFF.

Note: IPv6 example shamelessly ripped from the Wikipedia CIDR article.

For more info on Subnet masks themselves, what they mean and how the are used, I would recommend you see the question What are the essentials of a Subnet mask?
Or look at the extensive answer to How does Subnetting Work? over at Server Fault.

• Each octet is 8bits: 11111111.11111111.11111111.00000000 Oct 6, 2010 at 16:23
• So does that mean /16 is 255.255.0.0 and /8 is 255.0.0.0? Oct 6, 2010 at 18:53
• @Corey yes. And - as per Joe's binary there - just stick in the right number of one's, add enough 0's to reach 32, split in to four bytes and convert to decimal. It doesn't have to be a multiple of 8 either - /20 is 255.255.240.0 for example. Oct 6, 2010 at 19:01
• very good, professor DMA57361 Apr 14, 2011 at 23:40

DMA57361s answer of this representing a subnet mask is correct and sufficient already (+1) - I'd still like to offer a different approach in explaining this to provide some background regarding the history/motivation for this notation:

"192.168.15.0/24" is the compact specification of an IP address and its associated routing prefix, expressed in CIDR notation:

CIDR notation is constructed from the IP address and the prefix size, the latter being the number of leading 1 bits of the routing prefix. [emphasis mine]

The referenced short Wikipedia article already explains the topic at hand nicely; for a more thorough explanation of many related aspects you might consult the respective parent topic Classless Inter-Domain Routing - in particular you'll find there information about the historical Background for the change from subnet masks to prefix length/size.

Finally, for a good and intuitive representation on how to interpret these notations when you encounter them in practice you might look at the tables within IPv4 subnetting reference as well.

• Adds some good depth to the topic. +1 Oct 6, 2010 at 16:11

The /24 is the subnet 255.255.255.0. The /{number} at the end of an IP address is known as CIDR Notation.