CIDR Utilization

Jeremiah Millay jmillay at vermontel.com
Sat Oct 31 19:51:10 UTC 2015


John,
Without going through the hassle of installing a full-blown IPAM solution you could use Python's netaddr library to accomplish what you are asking:


>>> from netaddr import *
>>> cidr = IPSet(['192.168.0.0/24'])
>>> used = IPSet(['192.168.0.1','192.168.0.8/29','192.168.0.64/26'])
>>> cidr ^ used
IPSet(['192.168.0.0/32', '192.168.0.2/31', '192.168.0.4/30', '192.168.0.16/28', '192.168.0.32/27', '192.168.0.128/25'])




Jeremiah Millay
Senior Network Engineer
Vermont Telephone Co., Inc.
354 River Street
Springfield, VT 05156






More information about the NANOG mailing list