What's the difference between .0/32 and .1/24 in CIDR?

7,754

Solution 1

You definitely don't have the right grasp of CIDR.

The definition of a broadcast address isn't one that ends in .0. It's an address where all the host bits are set to zero. In a /32, there are no host bits. /32 isn't even a real world network address. It's no doubt being used to indicate that the number written is in fact an IP host address.

Solution 2

You've got your networking a little mixed up. An IPv4 ip address where all host bits are set to 0 is a network address. An IPv4 ip address where all host bits are set to 1 is a broadcast address. A .0 or a .255 in an IPv4 host ip address are perfectly valid depending on the subnet mask in use. The confusion comes from too many books, schools and instructors imploring students to "Never use .0 or .255 in a host ip address!" - Because it's easier to just teach that then to teach how and when they are perfectly valid.

Share:
7,754

Related videos on Youtube

pabo
Author by

pabo

Updated on September 18, 2022

Comments

  • pabo
    pabo over 1 year

    We're specifying CIDR addresses in AWS rules, and I came across something I don't understand.

    /32 means one single address. So 10.0.0.0/32 means only the single address 10.0.0.0. But an address ending in .0 is a broadcast address, right? So in effect, this single address means any address in the range 10.0.0.1 - 10.0.0.255.

    /24 means 255 addresses. So 10.0.0.1/24 means any address in the range 10.0.0.1 - 10.0.0.255. ( I don't use 10.0.0.0/24 here because that includes the .0 "expansion" we got above, and I'm trying to contrast with that.)

    Are the above statements correct? What is the effective difference between .0/32 and .1/24?


    edit

    I certainly may be very confused, and I appreciate the attempts to de-confuse me.

    My confusion about the .0 address being special in some way stems from my coworker telling me it was so. We set a rule on an AWS cluster to allow connections from 10.0.1.0/32, and it seemingly allowed a connection from 10.0.1.25. Is there another explanation for that?


    edit2

    Turns out my coworker was very wrong, even in reporting to me which address and subnet he used in the new AWS rule. Sorry for the confusion. If I could delete this question, I would.

    • Zoredache
      Zoredache about 9 years
      So 10.0.0.0/32 ... So in effect, this single address means any address in the range 10.0.0.1 - 10.0.0.255 - Why the heck would you assume that? Why do you think it would magically snap to a 24 bit mask, instead of a 8, 16, or some other random sized mask? There is no magical expansion.
    • pabo
      pabo about 9 years
      Thanks for the link to the wiki article. I actually did read that before posting. See my edit above for my confusion on the .0 address.
    • EEAA
      EEAA about 9 years
      possible duplicate of How does IPv4 Subnetting Work?
    • peterh
      peterh about 9 years
      @EEAA Exactly - it had to be marked as duplicate or migrated to SU.
    • Rick O'Shea
      Rick O'Shea about 2 years
      Nothing wrong with asking for clarification. The trailing zero is not expanded as you discovered. It's the network mask like /24 that determines what bits are for the network (24 of 'em) and which for hosts (the remaining 8 bits from the 32 bits available). So /24 leaves you with one whole byte for hosts: 256 of them.
  • pabo
    pabo about 9 years
    Thanks for your answer; it helped clear up to me that .0 is not in fact special as my coworker claimed.
  • pabo
    pabo about 9 years
    Thanks for your answer; it helped clear up to me that .0 is not in fact special as my coworker claimed.
  • DotNetSparky
    DotNetSparky almost 3 years
    Just to clarify one detail in this answer (and it's mentioned by the other answer here)--the broadcast address if one where all the host bits are ONE, not zero.
  • Rick O'Shea
    Rick O'Shea about 2 years
    Dang co-workers! :)