Skip to content

haidinhtuan/ip-provisioner

Repository files navigation

IP Provisioner

IP Provisioner Screenshot

This tool consolidates multiple network automation scripts into a single, unified Python program (ip_provisioner.py). It facilitates IP prefix conversion, DNS provisioning via ndcli, and various network health checks (BGP/RPKI, Whois, SOA).

Features (Ordered Workflow)

  1. Convert Prefixes (_01_convert): Normalizes IPv4 prefixes into a list of /24 subnets.
  2. Check BGP Advertising (_02_check_whois): Verifies if prefixes are announced anywhere via Team Cymru Whois.
  3. Check RPKI & IRR (_03_check_rpki): Validates BGP announcement, Route objects, and RPKI ROA status via RIPEstat.
  4. Check IP Usage (_04_check_usage): Checks current IP usage statistics using ndcli.
  5. Deploy DNS Records (_05_deploy_dns): Batch creates A records for all IPs in a subnet using ndcli.
  6. Check SOA Records (_06_check_soa): Verifies Reverse DNS Zone SOA records via dig.
  7. Undo DNS Records (_07_undo_dns): Bulk removes A records from DNS.

Prerequisites

  • Python 3.6+: Uses only the standard library (Zero external dependencies; no requirements.txt or pip install needed).
  • System Tools:
    • ndcli: Must be installed and configured in your PATH (See ndcli documentation).
    • dig: Required for SOA checks.
  • Network Access: Required for RIPEstat and Team Cymru API checks.

Installation

  1. Clone the Repository:

    git clone <repository-url>
    cd ip-provisioning
  2. Make the script executable:

    chmod +x ip_provisioner.py
  3. (Optional) Create an alias: Add the following to your ~/.bashrc or ~/.zshrc to run the tool from anywhere:

    alias ip-prov='/path/to/ip-provisioning/ip_provisioner.py'

Input Configuration

Before running the tool, add your assigned IP prefixes to input_prefix.txt.

  • Format: One prefix per line (e.g., 1.2.3.0/22).
  • Flexibility: It is fine to use different masks; the tool will automatically convert and expand them all into /24 subnets for the workflow.

Usage

1. Interactive Menu

Run the script without any arguments to enter the interactive mode.

python3 ip_provisioner.py

2. Command Line Interface (CLI)

Directly execute sub-commands:

  • python3 ip_provisioner.py convert
  • python3 ip_provisioner.py check-bgp
  • python3 ip_provisioner.py check-rpki
  • python3 ip_provisioner.py check-usage
  • python3 ip_provisioner.py deploy-dns
  • python3 ip_provisioner.py check-soa
  • python3 ip_provisioner.py undo-dns

Project Structure

The project is modularized for easier maintenance:

  • _00_shared/: Shared utilities and ndcli logic.
  • _01_ to _07_: Command modules corresponding to the menu options.

Author: Hai Dinh Tuan (me@haidinhtuan.com)

License: MIT License

Copyright (c) 2025 Hai Dinh Tuan

About

IP Provisioner is a modular, zero-dependency CLI tool designed to automate the lifecycle of IP prefix provisioning and DNS management. Built for Network Reliability Engineering (NRE) teams, it streamlines the complex workflow of validating, deploying, and verifying IP subnets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages