|
| 1 | +# Subnet Calculator |
| 2 | + |
| 3 | +A simple command-line subnet calculator written in Rust. |
| 4 | + |
| 5 | +## What it does |
| 6 | + |
| 7 | +- Calculates subnet info based on a network address, CIDR, and number of hosts |
| 8 | +- Handles multiple subnets |
| 9 | +- Lets you input data manually or import from a CSV file |
| 10 | +- Can save results as CSV or Markdown |
| 11 | + |
| 12 | +## Getting Started |
| 13 | + |
| 14 | +1. Make sure you have Rust installed. If not, grab it from [https://www.rust-lang.org/](https://www.rust-lang.org/). |
| 15 | + |
| 16 | +2. Clone this repo: |
| 17 | +git clone https://github.com/yourusername/subnet-calculator.git |
| 18 | +cd subnet-calculator |
| 19 | + |
| 20 | +4. Build it: |
| 21 | +cargo build --release |
| 22 | + |
| 23 | +4. Run it: |
| 24 | +./target/release/subnet-calculator |
| 25 | + |
| 26 | +Alternatively, [precompiled binaries for Windows](https://github.com/LuMarans30/Subnetting-rust/releases/latest) are available. |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +### Manual Input |
| 31 | + |
| 32 | +1. Choose option 1 |
| 33 | +2. Type in your network address with CIDR (like 192.168.1.0/24) |
| 34 | +3. Enter how many subnets you want |
| 35 | +4. For each subnet, enter the number of hosts you need |
| 36 | + |
| 37 | +### CSV Import |
| 38 | + |
| 39 | +1. Choose option 2 |
| 40 | +2. Enter the path to your CSV file |
| 41 | + |
| 42 | +Your CSV should look like this: |
| 43 | +(The first line is the initial network address with CIDR, then one line per subnet with the number of hosts) |
| 44 | +```csv |
| 45 | +<ip address>,<cidr> |
| 46 | +<num_host_1> |
| 47 | +<num_host_2> |
| 48 | +... |
| 49 | +<num_host_3> |
| 50 | +``` |
| 51 | +Alternatively, you can use a slash ('/') as a delimiter: |
| 52 | +```csv |
| 53 | +<ip address>/<cidr> |
| 54 | +<num_host_1> |
| 55 | +<num_host_2> |
| 56 | +... |
| 57 | +<num_host_3> |
| 58 | +``` |
| 59 | + |
| 60 | +## What You'll Get |
| 61 | + |
| 62 | +For each subnet, you'll see: |
| 63 | +- Network address |
| 64 | +- Subnet mask |
| 65 | +- CIDR |
| 66 | +- Subnet class |
| 67 | +- Broadcast address |
| 68 | +- Gateway |
| 69 | +- First and last usable host addresses |
| 70 | +- Request number of hosts |
| 71 | +- Actual number of hosts |
| 72 | +- How many IP addresses are wasted |
| 73 | + |
| 74 | +You can save all this info to a CSV or Markdown file if you want. |
0 commit comments