SubnetCalculator is a python script which allows you to divide a network into subnetworks.
It performs three main tasks:
- Determining the network address, the broadcast address and the host id range from a given IP address in CIDR notation.
- Dividing a given network into a specific number of sub-networks(FLSM).
- Dividing a given network into sub-networks using a number of hosts for each subnet(VLSM).
Before using this script, thanks in advance to respect the following rules:
- This program works only for IPv4 addresses.
- The format of an IP address must be as follows : x.x.x.x or x-x-x-x (with x between 0 and 255).
- The ip address's separator must be a dot(.) or a dash(-)
- The subnet mask must be given in CIDR notation /x with x between 1 and 31
- Thank you very much for taking the information above into consideration. Hope you're gonna like subnet/calculator :)
SubnetCalculator is a cross platform script that works with python 3.10 and above.
git clone https://github.com/0liverFlow/SubnetCalculator
cd ./SubnetCalculator
pip3 install -r requirements.txt
Then you can run it
SubnetCalculator.py [-h] --network network/subnet [--flsm N] [--vlsm N[,N]]
You can also execute the program using the Dockerfile. This can be simply done using the instructions below:
git clone https://github.com/0liverFlow/SubnetCalculator
cd ./SubnetCalculator
docker build -t subnet-calculator
Once the image is built, you can run it
docker run -it subnet-calculator --network 192.168.1.0/24 --flsm 2
docker run -it subnet-calculator --network 192.168.1.0/24 --vlsm 20 40 80
docker run -it subnet-calculator --network 192.168.1.0/24
docker run -it subnet-calculator --help