Generate a list of sub-networks from a starting network. Useful for creating a subnet allocation spreadsheet.
usage: main.py [-h] [-m MAX_PREFIX] [-c INDENT_CHAR] network
Subnet a network.
positional arguments:
network Network to subnet.
optional arguments:
-h, --help show this help message and exit
-m MAX_PREFIX, --max-prefix MAX_PREFIX
Maximum prefix length.
-c INDENT_CHAR, --indent-char INDENT_CHAR
Characters to use for indentation.
Subnet a /16 down to /20s:
python3 main.py 192.168.0.0/16 -m 20
192.168.0.0/16
192.168.0.0/17
192.168.0.0/18
192.168.0.0/19
192.168.0.0/20
192.168.16.0/20
192.168.32.0/19
192.168.32.0/20
192.168.48.0/20
192.168.64.0/18
192.168.64.0/19
192.168.64.0/20
192.168.80.0/20
192.168.96.0/19
192.168.96.0/20
192.168.112.0/20
192.168.128.0/17
192.168.128.0/18
192.168.128.0/19
192.168.128.0/20
192.168.144.0/20
192.168.160.0/19
192.168.160.0/20
192.168.176.0/20
192.168.192.0/18
192.168.192.0/19
192.168.192.0/20
192.168.208.0/20
192.168.224.0/19
192.168.224.0/20
192.168.240.0/20
Subnet a /12 down to /16 as a csv:
python3 main.py 172.16.0.0/12 -m 16 -c ","
172.16.0.0/12
,172.16.0.0/13
,,172.16.0.0/14
,,,172.16.0.0/15
,,,,172.16.0.0/16
,,,,172.17.0.0/16
,,,172.18.0.0/15
,,,,172.18.0.0/16
,,,,172.19.0.0/16
,,172.20.0.0/14
,,,172.20.0.0/15
,,,,172.20.0.0/16
,,,,172.21.0.0/16
,,,172.22.0.0/15
,,,,172.22.0.0/16
,,,,172.23.0.0/16
,172.24.0.0/13
,,172.24.0.0/14
,,,172.24.0.0/15
,,,,172.24.0.0/16
,,,,172.25.0.0/16
,,,172.26.0.0/15
,,,,172.26.0.0/16
,,,,172.27.0.0/16
,,172.28.0.0/14
,,,172.28.0.0/15
,,,,172.28.0.0/16
,,,,172.29.0.0/16
,,,172.30.0.0/15
,,,,172.30.0.0/16
,,,,172.31.0.0/16