Sigurbjörn Lárusson's blog

Musings of a network engineer

cidr6

cidr6 is a tool I wrote for IPv6 subnet calculations. For many years I (along with countless others probably) have used CIDR by Robert L. Lineberger as a tool for IPv4 subnet calculation. As the years have passed I've mostly memorized every conceivable combination but when shifting to IPv6 calculations I find that my binary math is sometimes lacking. I wrote a simple tool called cidr6 which aims to do the same thing that cidr does so well for IPv6 prefixes. It has some limitations, including:

  • It does not support prefixes which are smaller than /64, if you're going to use /126 or /127 prefixes, you really should allocate a /64 but use it as a /126 or /127 anyway!
  • It does not support prefixes which are larger than /16. If you have something larger than a /16, you can split it up into individual /16s and use the tool for those prefixes.
It's available in source code form from my github page as cidr6.c.and should compile on mostly any *nix platform using gcc -o cidr6 cidr6.c