Skip to main content

octodns-netbox

PyPI Python versions License

octodns-netbox is a source for octoDNS that reads IP addresses from NetBox. It creates A and AAAA records from the names you store on each IP address, and PTR records for your reverse zones.

It is a source, not a provider. octoDNS reads records from it and writes them to the DNS providers you configure as targets. The source cannot be a target, and it never writes to NetBox.

What it does

  • It reads the IP addresses in NetBox IPAM. Each IP address holds its names in the description field as a comma-separated list, or one name in the dns_name field.
  • It creates an A record for each IPv4 address and an AAAA record for each IPv6 address whose name is in a forward zone.
  • It creates a PTR record for each IP address in a reverse zone. It handles IPv4 zones on octet boundaries, IPv6 nibble zones, and classless IPv4 zones for prefix lengths 25 to 31. A classless zone name starts with the last octet of the network and the prefix length, such as 0/26 (the form in RFC 2317) or 0-26 (the form in RFC 4183).
  • It can read only the IP addresses in one VRF, or only the IP addresses with given tags.
  • It skips a name that octoDNS rejects, such as free text in a description, and logs a warning. The other records of the zone are still created.

It creates no other record types. It reads nothing from NetBox except IP addresses and, when you name a VRF, that VRF.

Install

pip install octodns-netbox

The package installs octoDNS as a dependency. Install the octoDNS provider for your DNS service as well.

Quick start

This example creates the records for zone example.test. and its reverse zone 100.51.198.in-addr.arpa.. It assumes that NetBox holds these IP addresses:

IP address Description
198.51.100.1/24 Host1.Example.TEST
198.51.100.2/24 Host2.example.test
  1. In NetBox, create an API token. The source sends only GET requests, so a token without write access is enough.

  2. Put the token in the environment variable NETBOX_TOKEN. Replace <token> with the whole token. A v2 token from NetBox 4.5 or later starts with nbt_.

    export NETBOX_TOKEN='<token>'
    
  3. Save this octoDNS config as config.yaml. Replace https://netbox.example.com with the URL of your NetBox.

    providers:
      netbox:
        class: octodns_netbox.NetboxSource
        url: https://netbox.example.com
        token: env/NETBOX_TOKEN
      yaml:
        class: octodns.provider.yaml.YamlProvider
        directory: ./zones
    
    zones:
      example.test.:
        sources:
          - netbox
        targets:
          - yaml
      100.51.198.in-addr.arpa.:
        sources:
          - netbox
        targets:
          - yaml
    
  4. See the changes that octoDNS plans:

    octodns-sync --config-file config.yaml
    

    The plan creates two records in each zone.

  5. Write the zones:

    octodns-sync --config-file config.yaml --doit
    

    octoDNS writes one file per zone to ./zones. The source lower-cases every name, so Host1.Example.TEST becomes host1:

    # example.test.yaml
    host1:
      ttl: 60
      type: A
      value: 198.51.100.1
    host2:
      ttl: 60
      type: A
      value: 198.51.100.2
    
    # 100.51.198.in-addr.arpa.yaml
    '1':
      ttl: 60
      type: PTR
      value: host1.example.test.
    '2':
      ttl: 60
      type: PTR
      value: host2.example.test.
    

    On the next run, the plan shows only the records that changed in NetBox. With octoDNS 1.10, a YamlProvider target reads no records from its directory, so each run plans every record as new. octoDNS 1.11 and later read the files.

  6. Replace the yaml target with the octoDNS provider of your DNS service.

Supported versions

Component Supported Tested in CI
Python 3.11 to 3.15 3.11, 3.12, 3.13, 3.14, and 3.15
octoDNS 1.10 or later, before 2.0 1.10.0 and the newest release
pynetbox 7.4.1 or later, before 8.0 7.4.1 and the newest release
NetBox 4.0 to 4.7 4.0 with a v1 token, 4.7 with v1 and v2 tokens, and every week the newest release with a v2 token

The NetBox tests run octoDNS against a real NetBox in Docker. Each pull request tests the pinned NetBox releases, each with the locked and the lowest direct dependency versions. Every week, CI also tests the latest image of netbox-docker, and it tests the lowest dependency versions again, because those inputs can change without a commit. A new NetBox release can fail the weekly run before this table lists that release. NetBox 4.5 and later v2 API tokens work with every supported pynetbox release, 7.4.1 included.

Documentation

Changes

GitHub Releases lists the changes in each version and the steps to upgrade.

Contributing

CONTRIBUTING.md tells you how to set up the project, run the tests, and release a version.

Security

To report a vulnerability, follow SECURITY.md. Do not open a public issue for it.

License

MIT

Metadata

Release files for octodns-netbox 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for octodns-netbox 0.6.0
File Size Uploaded Provenance Actions
octodns_netbox-0.6.0.tar.gz 14.2 kB With provenance Details for octodns_netbox-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for octodns-netbox 0.6.0
File Interpreter ABI Platform Actions
octodns_netbox-0.6.0-py3-none-any.whl Python 3 none any Details for octodns_netbox-0.6.0-py3-none-any.whl

Total release size: 27.2 kB

Release files / octodns_netbox-0.6.0.tar.gz

Download URL octodns_netbox-0.6.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
749ced28fcc7fa13ebb21bbb63d440cfde6935935d47abeb2b1cd44ccdb8231b
BLAKE2b-256 checksum
How to use checksums
e84dcd5cf92889df6546273a4d82d1fceb1f41e22ac93595e23e6f300eb23a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / octodns_netbox-0.6.0-py3-none-any.whl

Download URL octodns_netbox-0.6.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7153cb2a073604a3f772c6113f769b0cc6595cfc4c35d198d9ba037a6b925522
BLAKE2b-256 checksum
How to use checksums
a7b605a52b50bc04d3017946aa964ce3dfd8575b4025b541475328abc30eb73c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for octodns-netbox 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for octodns_netbox-0.6.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page