cidr-range-cli
v1.0.1
Published
A simple Node.js CLI tool to convert CIDR notation into Start and End IP ranges.
Maintainers
Readme
🌐 CIDR to IP Range CLI
A simple and reliable Node.js CLI tool to convert a CIDR block into:
- ✅ Start IP Address
- ✅ End IP Address
Perfect for DevOps engineers, Salesforce admins, and network teams who need to convert CIDR notation into start/end ranges for firewall rules, Salesforce Network Access, or profile login IP ranges.
📦 Installation
npm install -g cidr-range-cli
🚀 Usage
cidr-range -i <CIDR>Example
cidr-range -i 192.168.1.0/24Output
CIDR Input : 192.168.1.0/24
Start IP : 192.168.1.0
End IP : 192.168.1.255🔎 Supported Format
IP_Address/Prefix_LengthExamples
| CIDR | Description |
| ---------------- | ------------------- |
| 192.168.1.0/24 | 256 IP addresses |
| 10.0.0.5/32 | Single IP address |
| 10.0.0.0/16 | 65,536 IP addresses |
| 0.0.0.0/0 | Entire IPv4 range |
⚙️ CLI Options
| Option | Description |
| -------------------- | ------------------- |
| -i, --input <cidr> | Required CIDR input |
🛠 Why This Tool?
Salesforce requires Start IP and End IP values for:
- Profile Login IP Ranges
- Network Access (Trusted IPs)
- Connected App IP Relaxation
However, network teams typically provide IP ranges in CIDR format.
This tool bridges that gap instantly.
🧠 How It Works
Converts the IP address to a 32-bit integer.
Applies the subnet mask based on prefix length.
Calculates:
- Network address (Start IP)
- Broadcast address (End IP)
Converts values back to dotted decimal format.
📁 Project Structure
.
├── cidr-cli.js
├── package.json
└── README.md🔐 Error Handling
The CLI validates:
- Proper CIDR format
- Prefix length between 0–32
- Numeric IP octets
Invalid input example:
cidr-range -i 192.168.1.0/99Output:
Error: Invalid CIDR format. Example: 192.168.1.0/24🧪 Future Enhancements (Optional Ideas)
- CSV file input support
- Bulk CIDR conversion
- HTML report generation
- JSON output mode
- NPM global installation
- Unit tests
- IPv6 support
📄 License
MIT License (c) Mohan Chinnappan
📌 Example Workflow (Salesforce Admin)
Receive CIDR from network team:
203.0.113.0/24Run:
cidr-range -i 203.0.113.0/24Copy:
- Start IP
- End IP
Paste into Salesforce → Network Access
Happy Networking 🚀
