October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Set Up NSD as an Authoritative DNS Server on Ubuntu

A practical Ubuntu guide to installing NSD, creating an authoritative zone, configuring transfers, validating changes, opening DNS port 53, and testing public delegation.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To make Ubuntu authoritative for a domain, install the nsd package, define the zone in /etc/nsd/nsd.conf, create a valid zone file, validate both files, and expose DNS on UDP and TCP port 53. You must also delegate the domain to this server at its parent zone before Internet resolvers will use it.

NSD is an authoritative-only DNS server: it publishes data for zones you operate and answers recursive resolvers, but it does not provide recursive caching for client applications. The procedure below uses Ubuntu’s package-managed NSD and an illustrative example.com zone; replace addresses and records with values for your domain.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What NSD does—and what it does not do

NSD (Name Server Daemon) is designed to serve authoritative DNS data. When a resolver asks for a record in a zone loaded by NSD, it returns the answer with the authoritative (AA) flag. It does not look up arbitrary Internet names on behalf of clients and is not a recursive cache. Run a separate recursive resolver for workstation or application lookups, or point those clients at an existing resolver.

This distinction matters operationally. A server can answer direct queries for example.com while still being unable to resolve ubuntu.com for local users. Public authority also requires delegation at the parent zone and network reachability; installing NSD alone does not change the Internet’s delegation.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Choose the Ubuntu release and package source

Ubuntu’s package manager is the simplest installation route. NLnet Labs’ NSD 4.15.4 documentation describes distribution packages as the easy path, while warning that a distribution may lag upstream. Package versions are release-specific, so inspect the candidate on the machine you will configure instead of pinning a version copied from another release.

Reference Version shown How to use the information
Ubuntu Noble package manpage NSD 4.8.0-1build3 Applies to that Ubuntu release’s package metadata; do not assume it is the version on another release.
Ubuntu Resolute package manpage NSD 4.14.0-1 Use the manpage installed on the target system for option and utility details.
NLnet Labs installation documentation NSD 4.15.4 Upstream reference; source builds are an alternative when you need a newer release or compile-time options.

Record the release and package source before changing configuration:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
lsb_release -a
apt-cache policy nsd

The output tells you which Ubuntu archive supplies the package and which version will be installed. If a particular NSD feature is tied to a newer release, verify it against that release’s local manpage rather than relying on an upstream example.

Prerequisites for an authoritative server

  • A stable IPv4 address and, if you publish IPv6, a stable IPv6 address. The addresses must remain assigned to the host.
  • A hostname for the nameserver, such as ns1.example.net, with a working local system configuration.
  • Control of the zone you intend to serve and permission to change its parent-zone delegation.
  • Firewall and security-group rules allowing DNS on both UDP 53 and TCP 53. TCP is required for large responses and zone transfers.
  • A decision about whether this machine is a primary (master) for the zone or a secondary that transfers data from another authoritative server.
  • At least one independent secondary for a resilient public service. The exact number and geographic or network separation required by a registry or registrar vary by policy.

For a private, split-horizon, or laboratory zone, you can stop after local and network tests. For an Internet-facing zone, plan delegation and glue records before calling the deployment complete.

Install NSD with apt

  1. Refresh package metadata and install the daemon:
    sudo apt update
    sudo apt install nsd
  2. Confirm the installed package and utilities:
    nsd -V
    apt-cache policy nsd
    command -v nsd-checkconf nsd-checkzone

    The exact version printed is the one whose defaults and manpages govern this host. Keep that value in your deployment notes.

  3. Inspect the package-created configuration and service definition before editing:
    sudo less /etc/nsd/nsd.conf
    systemctl cat nsd

Building NSD from source is reasonable when the Ubuntu package is too old or you require compile-time options unavailable in the archive. A source installation has different paths, service integration, and upgrade responsibilities; do not mix its files with the distribution package without documenting the layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Understand nsd.conf

The main file is /etc/nsd/nsd.conf on the Ubuntu package. Its syntax is attribute: value. Current Ubuntu references describe top-level clauses including server:, zone:, pattern:, key:, and verify:. The file specifies server behavior, zone files, and primary/secondary relationships.

Minimal server and zone declaration

Start with an explicit listener and one zone. The addresses below are documentation ranges; substitute your server’s real addresses.

server:
    ip-address: 192.0.2.53
    ip-address: 2001:db8:53::53
    port: 53
    username: nsd

zone:
    name: example.com
    zonefile: /etc/nsd/example.com.zone

If the package’s existing file already defines defaults such as a zones directory, retain compatible settings and add the zone stanza in the style used there. A zone declaration needs the zone name and the path to its zone file; transfer settings are separate and should not be inferred from the declaration alone.

Keep configuration maintainable

  • Put nsd.conf and every zone file under version control, but restrict the repository and working files to administrators. Transfer keys are secrets.
  • Use absolute zone-file paths while you are establishing the service. This makes error messages unambiguous.
  • Keep one authoritative source of each zone. Do not edit generated copies on a secondary.
  • Use comments for the purpose of unusual listener or transfer settings, not for storing passwords or private keys.

Create an authoritative zone file

A zone file needs an SOA record, NS records, and the address records needed to reach those nameservers and services. This example is deliberately small and is not a complete production zone:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$TTL 3600
@   IN SOA ns1.example.com. hostmaster.example.com. (
        2026101501 ; serial: YYYYMMDDnn
        3600       ; refresh
        900        ; retry
        1209600    ; expire
        300        ; negative caching TTL
)

    IN NS ns1.example.com.
    IN NS ns2.example.net.

ns1 IN A    192.0.2.53
ns1 IN AAAA 2001:db8:53::53

@   IN A    192.0.2.80
www IN A    192.0.2.80
@   IN MX 10 mail.example.com.
mail IN A   192.0.2.25

Use fully qualified names with a trailing dot in SOA, NS, MX, and target records. The SOA serial is not decorative: increment it for every published change so secondaries know that new data is available. A date-plus-counter format such as 2026101501 is easy to audit; if you make two changes on one day, increase the counter rather than reusing the serial.

Nameserver address and glue considerations

If a nameserver’s hostname is inside the zone it serves—for example, ns1.example.com—the parent registry normally needs a glue address so resolvers can reach it without a circular lookup. The zone’s own A or AAAA record is still required. If the nameserver is in another domain, such as ns2.example.net, its address is maintained in that domain’s authoritative zone.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Configure primary and secondary transfers

Choose one role per zone. A primary publishes the editable zone file and notifies secondaries. A secondary obtains the zone by transfer and should not be edited by hand.

Role Relevant settings Purpose
Primary notify, provide-xfr Tell named secondaries about a new SOA serial and permit their AXFR/IXFR requests.
Secondary allow-notify, request-xfr Accept notifications from the primary and request the zone transfer.

Primary example

For a primary at 192.0.2.53 and a secondary at 198.51.100.54, an illustrative zone stanza is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
zone:
    name: example.com
    zonefile: /etc/nsd/example.com.zone
    notify: 198.51.100.54 transfer-key
    provide-xfr: 198.51.100.54 transfer-key

Secondary example

On the secondary, the same zone can be declared with the primary’s address:

zone:
    name: example.com
    zonefile: /var/lib/nsd/secondary/example.com.zone
    allow-notify: 192.0.2.53 transfer-key
    request-xfr: AXFR 192.0.2.53 transfer-key

Exact transfer syntax and supported options are version-sensitive; consult the nsd.conf(5) installed with your Ubuntu package. The examples show the relationship, not a substitute for checking that manpage.

Restrict transfers and authenticate them

Never expose unrestricted transfers on an Internet-facing primary. Use the secondary’s fixed address and a TSIG key. Define the key in a key: clause and reference the same key name in notify, provide-xfr, allow-notify, and request-xfr. Generate a strong, unique secret, store it with administrator-only permissions, and install it on both servers. Do not place a real secret in public configuration examples or source repositories.

An address allow-list without a key limits where transfers can originate; TSIG also authenticates the request. Use both controls. If a transfer fails, check that the key name, secret, algorithm, source address, and system clocks match on both hosts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Validate before starting or reloading

Validation catches syntax and zone errors before they become an outage. Run the utilities as the account that can read the configuration and zone files:

sudo nsd-checkconf /etc/nsd/nsd.conf
sudo nsd-checkzone example.com /etc/nsd/example.com.zone

A successful check normally exits without an error message and returns status zero. A failure identifies a line, token, missing file, malformed record, or invalid owner name. Correct the first reported error, then run both checks again. If a command is not present, inspect the package’s installed manpages and paths with dpkg -L nsd; do not substitute an unrelated DNS utility and assume it validates NSD semantics.

Check file ownership and permissions as well. The daemon must be able to read its zone files, while transfer-key files should not be world-readable:

sudo stat /etc/nsd/nsd.conf /etc/nsd/example.com.zone
sudo namei -l /etc/nsd/example.com.zone

Enable the service and verify listeners

  1. Enable NSD at boot and start it now:
    sudo systemctl enable --now nsd
  2. Check service state and recent logs:
    systemctl status nsd --no-pager
    sudo journalctl -u nsd -b --no-pager
  3. Confirm that the daemon is bound to the intended addresses and both transport protocols:
    sudo ss -luntp | grep ':53'

    You should see UDP and TCP listeners on each configured address. If only loopback is present, review the ip-address settings and host firewall. If another process owns port 53, stop or reconfigure it before starting NSD.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. After a zone-file change, increment the SOA serial, rerun both validation commands, and reload gracefully:
    sudo systemctl reload nsd

    If reload reports an error, inspect the journal and keep the last known-good configuration in place until the correction validates.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Query NSD directly with dig

Test the server’s address directly so a recursive cache or stale delegation cannot hide a local mistake.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
dig @192.0.2.53 example.com SOA
dig @192.0.2.53 example.com NS
dig @192.0.2.53 www.example.com A
dig @192.0.2.53 example.com MX
  • In the flags line, look for aa (authoritative answer).
  • Confirm that the SOA serial matches the zone file you installed.
  • Confirm that the NS set is the one you intend to delegate.
  • Check that A, AAAA, MX, and other records return the expected values and TTLs.

Test TCP explicitly when a firewall, DNSSEC data, or a large response is involved:

dig +tcp @192.0.2.53 example.com SOA
dig +tcp @2001:db8:53::53 example.com NS

Repeat the tests from another network when possible. A local query proves that NSD answered on the host; it does not prove that an external resolver can reach the address.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publish Internet delegation and glue

  1. At the registrar or registry for the parent zone, create host (glue) records for in-bailiwick nameservers and enter their IPv4 and IPv6 addresses.
  2. Set the domain’s NS delegation to the complete authoritative set, including an independent secondary.
  3. Open UDP and TCP 53 at every host firewall, cloud security group, load balancer, and upstream network involved.
  4. Wait for parent-zone and resolver caches to expire according to their TTLs, then query the delegated nameservers directly and through several external vantage points.
  5. Compare the externally visible SOA serial and NS records with the primary’s zone file. A mismatch usually indicates stale delegation, an incorrect glue address, a blocked path, or a secondary that did not transfer.

Registry rules differ by top-level domain, and the NSD documentation does not prescribe a universal number of nameservers or a specific registrar workflow. Follow the parent registry’s current requirements.

NSD compared with a combined DNS server

Ubuntu’s NSD documentation contrasts NSD’s authoritative-only design with servers that can also act as a resolver and cache. The choice affects architecture rather than the zone-file fundamentals.

Concern NSD Server with recursive mode
Primary purpose Authoritative service for configured zones. Can serve zones and recursively resolve/cache other names.
Configuration model nsd.conf with server, zone, pattern, key, and verification clauses. Different syntax and separate controls for recursion and authoritative data.
Transfer controls Explicit notify, provide-xfr, allow-notify, and request-xfr, preferably with TSIG and address restrictions. Equivalent concepts, but option names and defaults differ.
Recursive exposure Not provided, reducing the risk of accidentally running an open resolver. Must be tightly restricted with ACLs if recursion is enabled.
Updates Ubuntu packages may lag the current upstream release; inspect the target release before deployment. Package cadence and security process depend on the selected implementation.

For an authoritative-only edge service, NSD’s narrow role can simplify isolation. If the same host must provide recursive service, design that function separately rather than assuming NSD will supply it.

Troubleshoot common failures

The service will not start

  • Run sudo nsd-checkconf /etc/nsd/nsd.conf and read the first reported line.
  • Check for a missing zone file, incorrect path, or permissions that prevent the daemon user from reading it.
  • Use journalctl -u nsd -b to identify a port conflict or an address that is not assigned to the host.

Queries return REFUSED or no answer

  • Verify that the query is sent to the NSD address, not to a recursive resolver.
  • Confirm the requested zone name exactly matches the zone stanza, including the absence or presence of a trailing dot as required by the configuration syntax.
  • Check that UDP and TCP 53 are permitted and that NSD is listening on the queried IPv4 or IPv6 address.

The answer is not authoritative or is stale

  • Query the primary directly and inspect the aa flag and SOA serial.
  • Increment the serial after every edit and reload NSD only after validation succeeds.
  • On a secondary, inspect transfer logs and verify allow-notify, request-xfr, TSIG credentials, and source addresses.

Transfers fail

  • Ensure the primary’s provide-xfr permits the secondary’s actual source address.
  • Ensure the secondary requests from the primary’s reachable address and that TCP 53 is open.
  • Compare key names, secrets, algorithms, and clocks on both hosts. A TSIG mismatch is an authentication failure, not a zone-content error.

Operational checklist for each change

  1. Edit the version-controlled zone source or nsd.conf.
  2. Increment the SOA serial for any published zone-data change.
  3. Run nsd-checkconf and nsd-checkzone.
  4. Reload NSD and inspect the service journal.
  5. Query SOA, NS, and changed records over UDP; use TCP for the same records when transport size or policy warrants it.
  6. For a delegated zone, verify the result from outside the server’s network and confirm that secondaries report the new serial.

Following this sequence gives Ubuntu a reproducible authoritative NSD service: the daemon serves only the zones you declare, transfers are limited to known secondaries, and both local answers and public delegation are checked rather than assumed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.