nanog mailing list archives

RE: CIDR Utilization


From: Jeremiah Millay <jmillay () vermontel com>
Date: Sat, 31 Oct 2015 19:51:10 +0000

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





Current thread: