Authoritative DNS
Index
As part of the OPNsense Business Edition, Deciso offers a plugin for advanced DNS infrastructure requirements.
OPNDNS is based on PowerDNS Authoritative and hosts DNS zones on OPNsense. It can manage static internal zones, reverse lookup zones, and dynamic DNS updates from services such as KEA DHCP using RFC2136.
It supports record types that are usually outside the scope of a recursive resolver, such as MX, SRV and TXT.
In a common setup, Unbound DNS remains the recursive resolver for clients and forwards selected internal zones to this service.
Considerations before deployment
DNS role
This service is not a recursive resolver. It only answers for zones configured locally.
It is intended primarily for internal authoritative DNS use cases, such as infrastructure zones, reverse lookup zones and DHCP-driven dynamic updates. It is not meant to replace a dedicated public DNS setup for internet-facing domains.
It should normally not replace Unbound DNS as the DNS server for clients.
Instead, keep Unbound on port 53 and forward selected internal zones to this service on another port,
for example 53053.
Note
Unbound resolves arbitrary DNS names for clients. This service only answers for zones it is authoritative for.
Records and RRsets
The GUI uses the term record for simplicity.
Technically, each record entry represents an RRset. An RRset is the combination of:
one record name
one record type
one TTL
one or more values
For example, two IPv4 addresses for the same host are stored as one A RRset with two values:
host1.internal 300 IN A 192.168.1.10
host1.internal 300 IN A 192.168.1.11
In the GUI, this is entered as one record with host1 as name, A as type, 300 as TTL,
and both IP addresses as separate values.
Zone types
There are two zone types:
staticzones contain records managed through the GUI.allowupdatezones allow RFC2136 updates.
Static zones are intended for manually configured records, such as nameservers, infrastructure hosts, service records and reverse lookup records.
Dynamic zones are intended for automatic updates, for example from KEA DHCP.
Attention
Do not create manual records in dynamic zones unless you know exactly why they are needed. These zones are expected to be owned by RFC2136 update clients.
High availability
A global role controls how the service behaves:
Primarycreates and manages zones and records.Secondarycreates secondary zones and retrieves their contents from the configured peer.
The primary can allow one configured peer to transfer zones and can notify it when a zone changes.
Note
The HA design is intentionally simple. A single peer is configured globally and used for zone transfers and notifications.
Using this service as a secondary for public DNS infrastructure is not recommended, even if it is technically possible.
General settings
Most settings are straightforward. Enable the service, choose the role, configure the listen port, and optionally configure the HA peer.
Option |
Description |
|---|---|
Enable |
Enable the service. |
Listen Port |
Port used for DNS queries. |
Role |
Choose whether this firewall acts as |
Peer |
IP address and port of the peer DNS server. On a primary, this is used for zone transfers and notifications. On a secondary, this is the primary server. |
Disable HA sync |
Prevent general settings from being synchronized between HA peers. |
Tip
When Unbound listens on port 53, configure this service on a different port such as 53053
and forward the relevant zones from Unbound.
Option |
Description |
|---|---|
Primary nameserver |
Primary nameserver used in the SOA record, for example |
Responsible Mailbox |
Responsible mailbox encoded as DNS name, for example |
Refresh |
Time in seconds after which a secondary checks the primary for zone updates. |
Retry |
Time in seconds after which a secondary retries a failed refresh. |
Expire |
Time in seconds after which a secondary stops serving the zone if the primary cannot be reached. |
Minimum TTL |
Minimum TTL used in the SOA record. |
Note
SOA records are generated automatically. They do not need to be created manually.
If these settings are changed, existing zones must be deleted and recreated to receive updated SOA content. The serial is updated automatically on configuration changes and is used by secondary servers to detect updates.
Option |
Description |
|---|---|
Log Level |
Higher values log more details. Use high values only while debugging. Values can be between 1 to 9. |
Log DNS Queries |
Log incoming DNS queries. This can generate large amounts of log data. |
Log DNS Details |
Log additional DNS packet details for debugging. This can be noisy. |
Zone settings
Zones are configured in .
Option |
Description |
|---|---|
Zone Name |
Name of the zone, for example |
Type |
|
Allow Updates From |
Network allowed to send RFC2136 updates. Only used with |
Default TTL |
Default time-to-live for records in this zone. |
Description |
Optional description for your reference. |
Option |
Description |
|---|---|
Zone |
Zone this record belongs to. |
Record Name |
Record name. All names must be fully qualified in the zone. |
Type |
DNS record type, for example |
TTL |
Optional record-specific TTL. If empty, the zone default is used. |
Values |
One or more record values. Use one value per line. |
Description |
Optional description for your reference. |
Configuration examples
The following examples show a typical internal DNS setup with one forward zone and one reverse zone.
Unbound remains the DNS resolver for clients and forwards the local zones to this service.
The examples use:
Forward zone:
internalReverse zone for
192.168.1.0/24:1.168.192.in-addr.arpaNameservers:
ns1.internalandns2.internalListen port:
53053
Forward zone
This example creates a static internal zone called internal.
The zone contains two nameservers:
ns1.internalwith IPv4 address192.168.1.2ns2.internalwith IPv4 address192.168.1.3
Go to and set:
Option |
Value |
|---|---|
Enable |
|
Listen Port |
|
Role |
|
Press Apply.
Go to and set:
Option |
Value |
|---|---|
Primary nameserver |
|
Responsible Mailbox |
|
Refresh |
|
Retry |
|
Expire |
|
Minimum TTL |
|
Press Apply.
Go to and add:
Option |
Value |
|---|---|
Name |
|
Type |
|
Press Save.
Add the nameserver records for the new internal zone. If you do not use HA, you can skip the second nameserver value.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save.
Create the A records for the nameservers.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save and Apply.
The zone now contains answers for internal and both nameserver host records.
Tip
Test the result directly:
drill -p 53053 @127.0.0.1 internal NS
drill -p 53053 @127.0.0.1 ns1.internal A
drill -p 53053 @127.0.0.1 ns2.internal A
Reverse zone
A forward zone maps names to IP addresses. A reverse zone maps IP addresses back to names.
Example:
Forward zone:
internalReverse zone for
192.168.1.0/24:1.168.192.in-addr.arpa
Go to and add:
Option |
Value |
|---|---|
Name |
|
Type |
|
Press Save.
Here we reuse the nameservers of our static forward zone. If you do not use HA, you can skip the second nameserver value.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save.
Create the reverse records (PTR) for the nameservers.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save.
If you do not use HA, you can skip this record.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save and Apply.
Tip
Test the reverse lookup directly:
drill -p 53053 @127.0.0.1 -x 192.168.1.2
drill -p 53053 @127.0.0.1 -x 192.168.1.3
Forwarding from Unbound
Clients should normally query Unbound DNS on port 53.
Unbound can then forward only the locally hosted zones.
This keeps the client setup simple while separating recursive and authoritative DNS duties.
Go to and set:
Option |
Value |
|---|---|
Enable |
|
Listen Port |
|
Press Apply.
Go to and add forwarding entries for the zones.
Option |
Value |
|---|---|
Domain |
|
Server IP |
|
Server Port |
|
Press Save and add the next entry.
Option |
Value |
|---|---|
Domain |
|
Server IP |
|
Server Port |
|
Press Save and Apply.
When a client queries Unbound for ns1.internal, the request is forwarded to 127.0.0.1:53053.
The local service answers for the zone and Unbound returns the response to the client.
Note
Forwarding only applies to the configured domains. Internet DNS resolution continues to be handled by Unbound normally.
Dynamic DNS with KEA DHCP (RFC2136)
KEA DHCP can register client FQDNs through dynamic DNS updates using RFC2136.
This example registers DHCP clients in forward and reverse zones.
The example uses:
Parent zone:
internalForward zone:
dhcp.internalReverse zone:
1.168.192.in-addr.arpaNameservers:
ns1.internalandns2.internalDHCP subnet:
192.168.1.0/24DHCP pool:
192.168.1.100 - 192.168.1.199DNS server:
127.0.0.1DNS server port:
53053
Go to and add:
Option |
Value |
|---|---|
Name |
|
Type |
|
Allow Updates From |
|
Press Save.
Note
The IP address 192.168.1.3 represents the secondary DNS server in an HA setup.
You can omit this address when HA is not used.
By default, PowerDNS forwards RFC2136 updates received by a secondary zone to the configured primary server. Allowing the secondary DNS server here lets the primary accept those forwarded updates.
This is useful when Kea is active on the backup OPNsense node. Kea sends its updates to the local secondary server, which then forwards them to the primary server where the update is applied.
Then add an NS record for the zone. If you do not use HA, you can skip the second nameserver value.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save.
Note
This example reuses the nameservers from the already configured internal zone.
The nameserver host records, such as ns1.internal. and ns2.internal., are defined in the parent zone.
The dynamic dhcp.internal zone only references them with its own NS record.
Go to and add a new reverse zone. If you already created the reverse zone earlier just change it accordingly.
Option |
Value |
|---|---|
Name |
|
Type |
|
Allow Updates From |
|
Press Save.
Then add an NS record for the reverse zone if they do not already exist. If you do not use HA, you can skip the second nameserver value.
Option |
Value |
|---|---|
Zone |
|
Name |
|
Type |
|
TTL |
|
Values |
|
Press Save and Apply.
Note
The reverse zone also uses the same nameservers.
The PTR records themselves are created dynamically by KEA through RFC2136 updates. The NS record only defines which nameservers are responsible for the reverse zone.
Attention
Do not forget to add forwards from Unbound for these zones.
Go to , select a subnet and enable advanced mode.
Option |
Value |
|---|---|
Subnet |
|
Pools |
|
DHCP option data |
|
Auto collect option data |
Unchecked |
Routers |
|
DNS servers |
|
Domain name |
|
Dynamic DNS |
|
DNS forward zone |
|
DNS reverse zone |
|
DNS qualifying suffix |
|
DNS server |
|
DNS server port |
|
Override no update |
|
Override client update |
|
Update on renew |
|
Conflict resolution mode |
|
Attention
In KEA the zones and qualifying suffix must end with a trailing dot.
If certain hosts should get registered with custom hostnames, create a host reservation for them.
Go to and set:
Option |
Value |
|---|---|
Enabled |
|
Bind address |
|
Bind port |
|
Press Apply.
Note
This example does not use a TSIG key.
The communication is local and Allow Updates From restricts which clients can update the zone.
For a general DHCP setup, see KEA DHCP.
High availability setup
This example uses two OPNsense firewalls:
Primary:
192.168.1.2Secondary:
192.168.1.3
The primary manages the zones and allows the secondary to transfer them.
Primary
Go to on the primary and set:
Option |
Value |
|---|---|
Enable |
|
Listen Port |
|
Role |
|
Peer |
|
Disable HA sync |
|
Press Apply.
Create static and dynamic zones on the primary as usual. It manages the records and increases the zone serial on each Apply or when an RFC2136 client updates a record.
Secondary
Go to on the secondary and set:
Option |
Value |
|---|---|
Enable |
|
Listen Port |
|
Role |
|
Peer |
|
Disable HA sync |
|
Press Apply.
For a secondary server, records are not managed locally. The zone contents are received from the primary through zone transfer.
Add Authoritative DNS to .
The zones on the secondary are created when HA synchronization is triggered in
.
After the first sync, the secondary performs an AXFR zone transfer. Further changes are announced through NOTIFY messages.
It is recommended to transfer zones over the same link used for HA sync. TCP must be allowed between both nodes on the configured listen port.
Attention
The secondary is read-only. Records sync automatically via standard DNS zone transfers, you do not need any cron jobs for the HA sync.
RFC2136 updates must be sent to the primary. During failover, the secondary continues to serve the latest transferred zone state.
Good to know
SOA records
An SOA record defines basic authority and timing information for a zone. It contains the primary nameserver, responsible mailbox, zone serial and refresh timers used by secondary servers.
SOA records are generated automatically from the SOA settings.
They cannot be created manually as records in the GUI. To regenerate SOA content, delete and recreate the zone.
NS records
NS records define which nameservers are responsible for a zone.
Configure NS records explicitly for every zone.
For a zone named internal, a simple setup could use:
internal 300 IN NS ns1.internal
internal 300 IN NS ns2.internal
Additional zones can use the same nameservers.
Nameservers should also have matching address records. For reverse lookups, create corresponding PTR records as well.
Serial handling
When static zone content changes, the zone serial is increased so that secondary servers can detect updates.
Secondary systems should not manage records directly.
DHCP search domain
Clients can resolve short hostnames when DHCP provides a search domain.
For example, if KEA DHCP sends dhcp.internal as the domain name,
a client may resolve host1 as host1.dhcp.internal.
Note
Short name resolution depends on the client resolver behavior and the DHCP options it receives.
DNS itself still stores and answers for fully qualified names. The search domain is only applied by the client.
Firewall rules
If clients or peers query the service directly, allow TCP and UDP traffic to the configured listen port.
For zone transfers, TCP must be allowed between primary and secondary.
Tip
DNS queries commonly use UDP. Zone transfers require TCP.
Testing
Test direct queries before configuring Unbound forwarding.
drill -p 53053 @127.0.0.1 internal SOA
drill -p 53053 @127.0.0.1 internal NS
drill -p 53053 @127.0.0.1 ns1.internal A
drill -p 53053 @127.0.0.1 -x 192.168.1.2
If direct queries work but client queries fail, check the Unbound forwarding configuration first.
Log and diagnostics
If queries do not return the expected result, check:
service status
listen port
Unbound forwarding entries
firewall rules
zone existence
expected records
relative record names
trailing dots in record values where required
Attention
A query for host.internal only reaches the local zone when Unbound has a forwarding entry for internal.
Without forwarding, Unbound tries to resolve the name normally and does not automatically know about the locally hosted zone.