Skip to content

A Python-based tool for maintaining an accurate and up-to-date inventory of active IP addresses in Netbox.

Notifications You must be signed in to change notification settings

LoH-lu/netbox-nmap-scan

Repository files navigation

netbox-nmap-scan

Automatically maintain an up-to-date inventory of active IP addresses in your network using Netbox and nmap. This Python-based tool scans your network prefixes and keeps your Netbox instance synchronized with the current state of your network.

Features

  • Automatic scanning of all active prefixes in Netbox
  • Custom tag support for excluding prefixes from scanning
  • Tracking of last scan time for each IP address
  • DNS resolution support (optional)
  • Tested with Python 3.12.6 - 3.13.1 and Netbox 4.1.10

Prerequisites

  • Python 3.12.6 or later
  • Netbox 4.1.10 or later
  • nmap installed on your system
  • Required Python packages (listed in requirements.txt)

Setup

  1. Create the following Netbox configurations:

    Tags

    • autoscan: Identifies IP addresses added by this script
    • Disable Automatic Scanning: Add this tag to prefixes you want to exclude from scanning

    Disable Scanning Tag Configuration

    Autoscan Tag Configuration

    Custom Fields (optional)

    Add a custom field to track the last scan time for each IP address:

    Last Scan Time Custom Field

  2. Follow the detailed installation guide in our Wiki

Usage

The script will scan all prefixes with active status in your Netbox instance by default. Scanning time increases with the number of prefixes being scanned.

For detailed usage instructions and examples, please refer to our Wiki.

Performance Considerations

  • Scanning time scales with the number of prefixes
  • Consider scheduling scans during off-peak hours for large networks
  • Use the Disable Automatic Scanning tag strategically to optimize scan times

Roadmap

  • DNS server configuration in INI file for custom DNS resolution
  • Option to disable DNS resolution functionality
  • Toggle for last scan time tracking
  • Toggle for the progress bar display while importing
  • Toggle for the logger in the Python console
  • All-in-One setup script for easier deployment

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues, questions, or contributions, please:

  1. Check our Wiki
  2. Open an issue in this repository
  3. Submit a pull request with your proposed changes

About

A Python-based tool for maintaining an accurate and up-to-date inventory of active IP addresses in Netbox.

Topics

Resources

Stars

Watchers

Forks

Languages