0
我正在寫一個腳本獲取/ 16並將其分解到不同的子網(/ 24,23,27等)。我意識到我可能遇到衝突的子網,並且正在尋找一種方法來檢查它。我沒有發現ipcalc或netaddr中具體解決此問題的任何內容。謝謝youf或你的幫助檢查子網衝突
def subnetting(self, cidrBlock, subnets):
networks = subnets
cidrblock = cidrBlock
assigned_subnets = []
ipnetwork = IPNetwork(cidrblock)
subnet_list = ipnetwork.subnet(int(subnets))
for subnet in subnet_list:
assigned_subnets.append(subnet)
return assigned_subnets