> For the complete documentation index, see [llms.txt](https://doc.i4e.com.bd/networking/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.i4e.com.bd/networking/doc/dhcp-to-dns.md).

# Create DNS records for DHCP leases

[◀ Go back to main README](/networking/master.md)

## Description

This script adds (and removes) dns records based on dhcp server leases.

## Requirements and installation

Just install the script:

```
$ScriptInstallUpdate dhcp-to-dns;
```

Then run it from dhcp server as lease script. You may want to use [lease-script](/networking/doc/lease-script.md).

A scheduler cares about cleanup:

```
/ system scheduler add interval=15m name=dhcp-to-dns on-event="/ system script run dhcp-to-dns;" start-time=startup;
```

## Configuration

On first run a disabled static dns record acting as marker (with comment "`--- dhcp-to-dns above ---`") is added. Move this entry to define where new entries are to be added.

The configuration goes to `global-config-overlay`, these are the parameters:

* `Domain`: the domain used for dns records
* `HostNameInZone`: whether or not to add the dhcp/dns server's hostname
* `PrefixInZone`: whether or not to add prefix `dhcp`
* `ServerNameInZone`: whether or not to add DHCP server name

## See also

* [Collect MAC addresses in wireless access list](/networking/doc/collect-wireless-mac.md)
* [Comment DHCP leases with info from access list](/networking/doc/dhcp-lease-comment.md)
* [Run other scripts on DHCP lease](/networking/doc/lease-script.md)

[◀ Go back to main README](/networking/master.md)\
[▲ Go back to top](/networking/doc/dhcp-to-dns.md#top)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.i4e.com.bd/networking/doc/dhcp-to-dns.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
