A simple command-line subnet calculator written in Rust.
- Calculates subnet info based on a network address, CIDR, and number of hosts
- Handles multiple subnets
- Lets you input data manually or import from a CSV file
- Can save results as CSV or Markdown
-
Make sure you have Rust installed. If not, grab it from https://www.rust-lang.org/.
-
Clone this repo:
git clone https://github.com/LuMarans30/Subnetting-rust.git
- Enter the directory:
cd Subnetting-rust
- Build it:
cargo build --release
- Run it:
./target/release/subnetting
Alternatively, precompiled binaries for most platforms are available.
- Choose option 1
- Type in your network address with CIDR (like 192.168.1.0/24)
- Enter how many subnets you want
- For each subnet, enter the number of hosts you need
- Choose option 2
- Enter the path to your CSV file
Your CSV should look like this:
(The first line is the initial network address with CIDR, then one line per subnet with the number of hosts)
<ip address>,<cidr>
<num_host_1>
<num_host_2>
...
<num_host_3>
Alternatively, you can use a slash ('/') as a delimiter:
<ip address>/<cidr>
<num_host_1>
<num_host_2>
...
<num_host_3>
For each subnet, you'll see:
- Network address
- Subnet mask
- CIDR
- Subnet class
- Broadcast address
- Gateway
- First and last usable host addresses
- Request number of hosts
- Actual number of hosts
- How many IP addresses are wasted
You can save all this info to a CSV or Markdown file if you want.
This project was created as a learning exercise. While it's primarily for personal use, suggestions and improvements are welcome. Feel free to open an issue or submit a pull request if you have ideas to enhance its functionality.
This project is open-source and available under the MIT License.