Varying interpretations of improper CIDRs

September 3, 2005

What I mean by a 'CIDR' is a network address specification in CIDR notation (more at the Wikipedia entry for Classless Inter-Domain Routing).

A 'proper' CIDR is one where the host address portion is all zero. It's easiest to see this for /8's, /16's, and /24's; for example, is a 'proper' CIDR, with the last two octets zero, but is not.

Every so often people argue for flexible interpretations of CIDRs that allow for 'improper' ones. This is a bad idea. Assuming that your software accepts something like '' at all, what IP address range does it mean? There are at least three possibilities:

1. to
The proper /16 that contains
2. to
A /16 sized address range starting at
3. to
The portion of the proper /16 starting at

All three are plausible answers. Which one any particular piece of software uses depends on the implementation details of how it parses CIDRs. And of course this means that different programs you have, or your programs and my programs, may well have different views on what they cover.

Sidebar: it's probably best to write CIDRs out in full

It's popular to abbreviate CIDRs by leaving off zero octets that are part of the host address portion, for example writing '200/8' instead of ''. Unfortunately, as someone found recently, not all software accepts the short form. And worse, not all software that doesn't really accept the short form will tell you about it; sometimes it will try to guess what it thinks you really meant and get it wrong.

Written on 03 September 2005.
« The 'Trade Press' and blogs
Weekly spam summary on September 3rd, 2005 »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Sep 3 03:21:31 2005
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.