Advanced Subnet Calculator is a CLI tool written in Python for calculating IPv4 subnets. This tool supports both standard subnetting and Variable Length Subnet Masking (VLSM). It is designed to help network administrators and enthusiasts efficiently manage and allocate IP addresses within a network.
- Convert decimal to 8-bit binary and vice versa
- Binary counting for subnet calculations
- Generate subnets based on the main network address, CIDR, and the number of subnets
- Calculate subnet masks, network addresses, broadcast addresses, and maximum nodes
- Support for both standard subnetting and VLSM
- Input validation for IP addresses and subnet counts
- Python 3.10 or higher
- Compatible with Windows, Linux, and macOS
-
Clone the repository:
git clone https://github.com/himansaBro/Advanced-subnet-calculator.git cd Advanced-subnet-calculator
-
Run the script:
python3 subnet_calculator.py
-
Standard Subnetting
Enter IP/CIDR..(e to exit)..............: 192.168.1.0/24 Enter number of Subnets,0 for no subnets: 4 Use VLSM Subnetting(y=yes/n=no/i=info)..: n
Output:
Main # 192.168.1.0/24 -Nodes : 256 -Subnet Mask : 255.255.255.0 -Network Adress : 192.168.1.0 -Brodcast Adress : 192.168.1.255 Subnet # 1 192.168.1.0 / 26 -Nodes : 64 -Subnet Mask : 255.255.255.192 -Network Adress : 192.168.1.0 -Brodcast Adress : 192.168.1.63
-
VLSM Subnetting
Enter IP/CIDR..(e to exit)..............: 192.168.1.0/24 Enter number of Subnets,0 for no subnets: 6 Use VLSM Subnetting(y=yes/n=no/i=info)..: y
Output:
Main # 192.168.1.0/24 -Nodes : 256 -Subnet Mask : 255.255.255.0 -Network Adress : 192.168.1.0 -Brodcast Adress : 192.168.1.255 Subnet # 1 192.168.1.128 / 26 -Nodes : 64 -Subnet Mask : 255.255.255.192 -Network Adress : 192.168.1.128 -Brodcast Adress : 192.168.1.191 -Subnet Level : 0
This method is simpler and creates equal-sized subnets. It may lead to IP address wastage if the number of required subnets is not a power of 2.
This method allows for subnets of varying sizes, making efficient use of IP addresses. It is more flexible but also more complex.
The tool includes checks for:
- Valid IP addresses and CIDR notation
- Valid subnet counts that the network can handle
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to contribute to this project by submitting issues or pull requests. For major changes, please open an issue first to discuss what you would like to change.
- Developed by Himansa [CodeHack] (github.com/himansaBro)
- Inspired by network administration needs and IP address management
For suggestions, comments, or contributions, please contact himansarajapacksha@gmail.com.