12

If an IP Address is indicated like this: 10.39.25.151/24 , what does the /24 mean?

  • 2
    I think it's called CIDR notation. It tells you something about the range of IP addresses for the network. For details beyond that you'd have to read about subnets and subnet masks. – barlop Jan 5 '17 at 3:16
  • @barlop : Yes, this is absolutely CIDR notation (also known as "slash notation"). I am certain of that. Fooey; I thought about that while writing my answer, but somehow left it off my answer. (I have since added that into the answer, for anyone who may just reads answers and not comments.) Thank you for the worthy addition of that good comment. – TOOGAM Jan 5 '17 at 5:38
15

It indicates the subnet mask of the IP.

IP has 32 bits, and number after the slash tells you where does the network part end, host part starts.

IP 10.39.25.151 written in binary format looks like this:

00001010001001110001100110010111

and /24 says that first 24 bits are used for network designation, while last 8 bits are used for various hosts inside that network.

/24 means that hosts on network can have IPs that are different by last 8 bits only, so IPs from range 10.39.25.1 - 10.39.25.255, with last .255 IP being used as broadcast address for the network.

See these two links for more details about subnet mask, and how they work.

https://support.microsoft.com/en-us/kb/164015

https://www.iplocation.net/subnet-mask

/24 indicates a subnet mask of 255.255.255.0, or in binary octets.

11111111.11111111.11111111.00000000

A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address. Subnet Mask is made by setting network bits to all "1"s and setting host bits to all "0"s. Within a given network, two host addresses are reserved for special purpose, and cannot be assigned to hosts. The "0" address is assigned a network address and "255" is assigned to a broadcast address, and they cannot be assigned to hosts.

| improve this answer | |
  • i'm a bit rusty, but reading through what you wrote, it all sounds brilliant and spot on. With one single exceltion. The last sentence you wrote. Classes are FAMOUSLY way out of date, and the only people that tend to make the mistake of talking about classes are people that learnt from cisco textbooks that are out of date on that and they never researched to find out that they were out of date on that. In fact the CIDR or slash notation, that C of CIDR is CLASSLESS.. as opposed to classful. Classful addressing hasn't been used for maybe even decades now. – barlop Jan 5 '17 at 6:27
  • 1
    is there any difference then between 172.18.0.150/24 and 172.18.0.0/24? – João Pimentel Ferreira Feb 17 '19 at 14:06
  • @JoãoPimentelFerreira Have you figured it out? – Roman Aug 21 '19 at 0:20
4

The number after the slash refers to the size of the network.

Specifically, the number after the slash specifies how many bits in the netmask have a value set to 1 before the first bit that is set to zero. This style of specifying a network's size is most formally called "CIDR notation", and is sometimes also called "slash notation".

So, 192.0.2.0/24 refers to the network (or "subnetwork", a.k.a. "subnet") with a netmask of 11111111111111111111111100000000. (The netmask matches the address's length. Since IPv4 addresses have 32-bit addresses, IPv4 uses 32-bit netmasks. Since IPv6 addresses have 128-bit addresses, IPv6 uses 128-bit netmasks.)

What this means is that 24 bits are used to specify a network ID, leaving 8 bits to identify a host. There are 2 possible values in binary, and 2 raised to the 8th power is 256, so there are 256 addresses that can be in that network. So, the 192.0.2.0/24 network goes from 192.0.2.0 through 192.0.2.255.

Similarly, the 192.0.2.0/29 network goes from 192.0.2.0 through 192.0.2.7. (Since 29 of the bits are reserved for identifying the subnet, that leaves 3 bits for the addresses. 2 raised to the 3rd power is 8.)

Side note: All of those addresses are part of the subnet. In IPv4, they are not all "usable", based on the IPv4 standard of the first and last addresses being "unusable", for compatibility with various equipment that may support "broadcast packets". The last address is typically called the "broadcast address". The first address is typically called the "Network ID", but the technical reason that the Network ID was ever declared to be unusable was from historical concerns of compatibility with some equipment that broadcasted on the first address.

For more fun of looking at different subnet sizes, you may want to look at a VLSM chart.

The reason why /24 is so common is because IPv4 addresses tend to be written out in octets. /24 allows the Network bits and the Host bits to be split after 24 bits, which ends up being after the third octet. So, people can tell rather easily (and without being very error prone) whether a device is part of a specific network, or a different network.

| improve this answer | |
  • some of what you've written sounds really confusing. You wrote "The number after the slash refers to the size of the network." OK. Then you write "Specifically, if you have a netmask, it refers " So that suggests that you can have a number after a slash and not have a netmask, and I don't think that is correct. And you haven't said the key point, that the number after the slash IS the netmask. When you have a slash and a number, there is no "if you have a netmask" (afaik anyway!) It's not an if. You Have. – barlop Jan 5 '17 at 6:32
  • you wrote "There are 2 possible values in binary, " <-- err no. A Binary digit can have 2 possible values. . Nobody would say there are 10 possible values in decimal. It's a decimal digit can have 10 possible values. But an infinite number of possible values can be represented in any base, binary, decimal, whatever. (though funnily enough probably not every value! e.g. a 1/3 without a division sign, can perhaps not really be represented in base 10 e.g. one has to write 0.3333333 but that's another matter). – barlop Jan 5 '17 at 6:34
  • @barlop : Regarding your first comment, my second sentence did say what the number after the slash is. However, I used the word "it", and the sentence's pronoun could have been interpreted as referring to the netmask. I agree with your point, and decided fixing would be worthwhile, so I re-wrote for clarity. Regarding your 2nd comment (the one about possible values), I declare that's just being picky, so I don't intend to expend effort re-phrasing that. – TOOGAM Jan 6 '17 at 6:51
  • re that second comment, It's not picky, it's just quoting you saying something plain wrong. and saying it's wrong. And if somebody doesn't know much about binary then they might believe it and parrot it as a fact , taking it as its word / literally, while they try to understand the concepts, and they'll have a completely wrong concept. If somebody was teaching a class and said that, then they should be sacked, because it's blatantly wrong and very bad if you're telling somebody that doesn't already understand what you're explaining, well enough to spot your error and see past it. – barlop Jan 9 '17 at 21:51
  • Okay, @barlop , but have you considered that perhaps it's not wrong? After re-reading what I wrote, it still didn't feel "wrong" to me. If interpreted that as "There are 2 possible values [a number can have,] in binary", it seems wrong. If interpreted as meant, as "There are 2 possible values [a digit can have,] in binary", then it's right. The statement was more ambiguous than it could've been, but if you really want to get technical, I didn't say that there are "only 2 possible values". There are two possible values in decimal (along with eight more possible values a single digit may have) – TOOGAM Jan 10 '17 at 2:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.