Skip to content

NetBox GeoIP v1.0

Choose a tag to compare

@jcl06 jcl06 released this 07 Nov 08:01

🧭 NetBox GeoIP Plugin β€” v1.0

βš™οΈ Requirements

Release Date: February 2025
Requires: NetBox 4.0.5 - 4.1.3 β€’ Python β‰₯ 3.10


πŸŽ‰ Initial Release

The first public release of the NetBox GeoIP Plugin, providing IP geolocation data management directly within NetBox.

✨ Key Features

  • GeoIP Data Model

    • Store and manage geolocation metadata for IP Addresses and Prefixes.
    • Includes fields for:
      • Country
      • Region
      • Subdivision Code
      • City
      • Subnet
      • Status
  • Integration with NetBox Custom Fields

    • Adds four custom fields to IP Addresses and Prefixes:
      • geoip_feed – Enable or disable GeoIP for the object.
      • country – Linked to Country model.
      • region – Linked to Region model.
      • city – Text field for specifying the city name.
    • Automatically groups these under a "GeoIP Info" section.
  • Built-in Country and Region Data

    • Preloaded CSV data for all ISO country and region codes.
    • Data automatically imported during migration.
  • Dynamic Region Filtering

    • When selecting a country, the Region dropdown dynamically filters available regions.
  • Automatic Field Creation

    • Migration 0004_create_custom_fields.py automatically creates GeoIP-related custom fields in NetBox.
  • IPAM URL Integration

    • Migration 0005_update_ipam_urls.py automatically edit ipam.urls.py.
    • This is to extend NetBox’s Prefix and IPAddress add/edit pages to include GeoIP fields to have Dynamic Region Filtering.
      + from netbox_geoip import views as netbox_geoip_views  # added on the top
      
      # Prefixes
      ...
      + # path('prefixes/add/', views.PrefixEditView.as_view(), name='prefix_add'),
      + path('prefixes/add/', netbox_geoip_views.CustomPrefixAddView.as_view(), name='prefix_add'),
      ...
      + # path('prefixes/edit/', views.PrefixBulkEditView.as_view(), name='prefix_bulk_edit'),
      + path('prefixes/edit/', netbox_geoip_views.CustomPrefixBulkEditView.as_view(), name='prefix_bulk_edit'),
      ...
      
      # IP addresses
      ...
      + # path('ip-addresses/add/', views.IPAddressEditView.as_view(), name='ipaddress_add'),
      + path('ip-addresses/add/', netbox_geoip_views.CustomIPAddressAddView.as_view(), name='ipaddress_add'),
      ...
      + # path('ip-addresses/edit/', views.IPAddressBulkEditView.as_view(), name='ipaddress_bulk_edit'),
      + path('ip-addresses/edit/', netbox_geoip_views.CustomIPAddressBulkEditView.as_view(), name='ipaddress_bulk_edit'),

πŸ’» Installation

NetBox Configuration

Add the plugin to the NetBox config. ~/netbox/configuration.py

PLUGINS = ["netbox_geoip"]

Installation

$ source /opt/netbox/venv/bin/activate
(venv) $ pip install /path/netbox-geoip

To add the netbox_geoip tables to NetBox database:

(venv) $ python manage.py migrate netbox_geoip