Subnetron is a high-performance subnet calculator built in Go.
It validates IP addresses and CIDR notations, generates subnet masks, computes network and broadcast addresses, determines usable IP ranges and calculates host availability — all with comprehensive unit test coverage to ensure correctness and reliability.
- IP Address Validation – Rejects invalid or reserved addresses.
- CIDR Validation – Supports the full IPv4 range (
/0–/32). - Subnet Mask Generation – Derives masks directly from CIDR values.
- Network Address Calculation – Computes the base network address via bitwise operations.
- Broadcast Address Calculation – Identifies the last address in a subnet.
- Usable IP Range – Determines the first and last usable hosts.
- Host Capacity – Calculates available host addresses per subnet.
- Unit Tested – All core functions validated using Go’s testing framework.
- Go to the Releases page.
- Download the binary for your platform (Linux, macOS, or Windows).
- Make it executable (Linux/macOS):
chmod +x subnetron
Run the tool:
./subnetron -ip 192.168.1.10 -cidr 24 Make sure you have Go installed.
git clone https://github.com/lenardjombo/subnetron.git
cd subnetron
go build -o subnetron main.go
./subnetron -ip 192.168.1.10 -cidr 24Subnetting is a foundational skill in networking, system administration and cybersecurity. Misconfigurations in subnetting often lead to:
- Inefficient IP allocation and wasted address space
- Increased routing complexity
- Security vulnerabilities from improper segmentation
Subnetron automates subnet calculations, reducing human error and providing:
- Network Engineers → Faster IP planning and allocation
- Security Analysts → Reliable tools for auditing segmentation
- Students & Learners → A hands-on way to master IP addressing
Subnetron leverages CIDR arithmetic and bitwise operations to compute subnet details.
Example: 192.168.1.10/24
-
CIDR → Subnet Mask
/24means 24 network bits, 8 host bits- Subnet mask →
255.255.255.0
-
Network Address
192.168.1.10 AND 255.255.255.0 = 192.168.1.0
- Broadcast Address
Invert mask, OR with network = 192.168.1.255
-
Usable Range
-
First usable →
192.168.1.1 -
Last usable →
192.168.1.254 -
Host Capacity
2^(32-24) - 2 = 254 usable hosts
Subnetron includes unit tests for every core function, ensuring accuracy and preventing regressions.
Coverage includes:
Sample tests :

- CIDR validation (
0 ≤ CIDR ≤ 32) - IP validation (rejects invalid/reserved addresses)
- Subnet mask generation for multiple CIDR values
- Network & broadcast address derivation
- Usable IP range correctness
- Host count verification
- Written in Go for performance and reliability
- Uses Go’s
netandmathstandard libraries - Structured with modular, testable functions
- Implements defensive programming practices
- Extend support for IPv6 subnetting
- Build a CLI tool for system administrators
- Add a web-based UI for educational and visualization purposes
- Completed core functionality
- Comprehensive testing included
- Planned feature expansions (IPv6, CLI, Web UI)
This project is released under the MIT License.
