CIDR - Classless Inter-Domain Routing
Tool for calculating masks from address ranges.
In the old days, IPv4 addressing was easy. If you had network 10.0.0.0/8,
you knew that 10 was the network address and 0.0.0 to 255.255.255 were
addresses for your hosts. Well, it's not so easy not, classless
addressing means that the standard classes of /8, /16 and /24 are gone.
That number can now be anything, it's a good thing (TM) but difficult to
calculate. When digiServ (http://www.digiserv.net/) asked me if I could
code a tool to calculate the network addresses for rangers of addresses to
help them firewall troublesome users without affecting people from other
netblocks, I jumped at the task. This tool will works like this:
cidr [starting address] [ending address].
If I specify cidr 126.96.36.199 188.8.131.52
I will get the following information back:
That is what this tool is for. It can also help you specify the smallest
netblock you should be using to contain your hosts. The tool consists of
two main files:
cidr.c <- The main library code
cidr_cmd.c <- The command line interface
The less important files are:
cidr_oop.cpp <- The C++ wrapper class code
cidr.h <- The header for the cidr.c library and class
cidr_config.h <- Miscellaneous options for building the code.
Under win32/ you will also find a GUI program for Windows users.
It is recommended that you use the binaries for Win32 as you may
have difficulty building the GUI.
To build the command line tool:
On GNU / UNIX systems, type:
as root, then:
then make clean.
You will have compiled and installed cidr. Then just type cidr -h for
On Borland C++, type:
make -f Makefile.bor
Then copy cidr.exe to whereever you wish. Though win32.bin/cidr.exe might
be smaller due to UPC compression, so I recommend you use that version.