octodns-routeros
RouterOS DHCP lease source for octoDNS.
Fetches active (bound) DHCP leases from a MikroTik RouterOS device via the REST API and provides them as DNS A/AAAA records.
Router-side prerequisites
Enable the HTTPS API service on the router:
/ip service enable www-ssl
Or for plain HTTP (not recommended):
/ip service enable www
Installation
pip install octodns-routeros
Configuration
providers:
routeros:
class: octodns_routeros.RouterOSSource
# Required: router hostname/IP
host: 192.0.2.1
# Required: API user
user: admin
# Password: literal value, or env/<var> to pull from environment
password: env/ROS_PASS
# Optional settings (shown with defaults)
scheme: https
verify: false
port: null # null = default port (443/80)
timeout: 10
ttl: 300 # TTL for generated records
zones:
dyn.example.com.:
sources:
- routeros
targets:
- your_dns_provider
Alternatively, the password can be specified directly:
password: your_secret_password
Or via a ROS_PASS environment variable in the shell running octoDNS.
How it works
On each sync cycle, the source:
- Queries the RouterOS REST API for bound DHCP leases from both
/rest/ip/dhcp-server/lease(IPv4) and/rest/ipv6/dhcp-server/lease(IPv6). - Each bound lease with a non-empty
host-namecreates a record:- Only the first label of the host name is used as the record name
(e.g.
laptop.lanbecomeslaptop). - IPv4 addresses produce A records.
- IPv6 addresses produce AAAA records.
- Only the first label of the host name is used as the record name
(e.g.
- A missing IPv6 endpoint (HTTP 404) is silently ignored — safe for RouterOS 6.x or routers without IPv6 DHCP.
Development
# Install dependencies
uv sync --group dev
# Run tests
uv run pytest
Releasing
- Update
CHANGELOG.md— move the new version's entry from- unreleasedto a date and add any missing items. - Commit and push to
main. - Tag the release:
git tag 0.2.0 && git push --tags.
CI will run the test suite, build the package, create a GitLab Release with the changelog section, and publish to PyPI.
Changes
See CHANGELOG.md for release history.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file octodns_routeros-0.2.0.tar.gz.
File metadata
- Download URL: octodns_routeros-0.2.0.tar.gz
- Upload date:
- Size: 66.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d01fd54c6a5e69c09b96d3aed1b6c512f181a05e26f7ed40f62ae279b6e304dd
|
|
| MD5 |
012ecf1794d4a5b42c4ebecc9cd37c31
|
|
| BLAKE2b-256 |
3356eaba7cce10ced846c0398abf4f7cb61d909bc3727f620e818da20d854ef6
|
File details
Details for the file octodns_routeros-0.2.0-py3-none-any.whl.
File metadata
- Download URL: octodns_routeros-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c6f78daa94eaa662b0d9734d9b3d4f359fab636666f0fac6ad9062c52f7eca7
|
|
| MD5 |
0adb07d4a344a1611ff14047637ae8f9
|
|
| BLAKE2b-256 |
afedc8dbb3d9fd7b222adc9d07c6f13a378c8bfca59b89eb859ec23b4bf20e6e
|