What's the meaning of /24 in the following command?
route add -net 192.168.15.0/24 192.168.8.10
|
What's the meaning of
|
||||
|
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 So
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
Usage with IPv6The 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 An IPv6 subnet can be represented in the same way, for example 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? |
|||||||||||||||
|
|
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:
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. |
|||||
|
|
The /24 is the subnet 255.255.255.0. The /{number} at the end of an IP address is known as CIDR Notation. |
|||
|
|
routefor a while), but that gateway is from a different subnet. Or is this just a made up example? – Azz Apr 14 '11 at 20:43