3

In IPv6, we can collapse 0's when talking about addresses.

In IPv4, can I write 192.168.1.0/24 as 192.168.1/24? Can I write 10.0.0.0/8 as 10/8?

I'm working on some software that takes CIDR's as arguments and some of my customers have provided these "short hand CIDRs". I want to know if they are valid or not.

Thanks!

3 Answers 3

4

Collapsing IPv4 addresses like that is not a standard the way it is with IPv6. There are some applications which can take addresses like that, but you will find that most do not. It is fine, and recommended, to leave off the leading zeros in each IPv4 octet (some things will misread leading zeros to mean octal notation), but you shouldn't collapse octets.

2

While it may be acceptable to write or speak that way, very few systems will accept an address entered that way. Ultimately, no engineer will enter an address like that, so there's little point coding your software to accept it.

(for example, what does 10.1/8 mean? In CIDR, it's nonsense. In a classful system, that would be network == 10, host == 1, or 10.0.0.1.)

1

Juniper boxes will happily accept routes like 0/0 or 10/8. IOS certainly doesn't, and i'm pretty sure that XR doesn't either.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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