Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk11 min

How to Set Up Custom Nameservers (ns1 and ns2) With Virtualmin on a VPS

A complete Virtualmin VPS guide to registrar glue, matching DNS records, nameserver templates, verification commands, propagation and secondary DNS.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run branded nameservers such as ns1.example.com and ns2.example.com from a Virtualmin VPS, you must configure three matching layers: child-host (glue) records at your registrar, A and NS records in the Virtualmin DNS zone, and the nameserver defaults used by Virtualmin for new domains. Registering the hostnames at the registrar is mandatory because Virtualmin cannot create or edit registrar glue. Once all three layers use the same names and public IP addresses, verify delegation with whois and host, then allow a few hours—up to 48 hours according to Virtualmin’s guidance—for changes to propagate.

What custom nameservers are you configuring?

A custom nameserver arrangement gives your hosted domains branded authoritative DNS endpoints instead of exposing a registrar’s default names. In this example, the names are ns1.example.com and ns2.example.com. The labels are only examples; replace example.com and the IP addresses with your own values.

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.

Four records or settings have to agree:

Layer What it contains Where you change it Why it matters
Child-host registration (glue) ns1.example.com and ns2.example.com mapped to public IP addresses Your domain registrar Lets resolvers find the IP address of a nameserver whose name is inside the domain it serves
Domain delegation The domain’s delegated NS set, normally ns1.example.com and ns2.example.com Your registrar Tells the DNS system which servers are authoritative for the domain
Zone records NS records plus A records for the two nameserver hostnames Virtualmin’s DNS Records page Provides the authoritative answer and resolves each nameserver name to an address
Virtualmin template Primary and additional nameserver hostnames Webmin’s Server Templates settings Controls the NS set written for newly created hosted domains

Virtualmin’s own wording is the key rule: NS records on the Virtualmin server should align with the glue records. A mismatch can produce intermittent failures or SERVFAIL, even when one lookup appears to work.

Requirements and planning before you touch DNS

Use a supported, clean VPS installation

Start with a fresh operating system supported by your Virtualmin edition and installation method. Virtualmin’s installation material recommends a supported OS and a domain whose DNS records can point to the server’s public IP. The official download and installation references are Virtualmin’s downloading and installing guide and the automated installation documentation.

#1 Best Overall

Give the VPS a proper hostname before installing or configuring services. The hostname should be a fully qualified name that resolves appropriately while you perform the setup. Keep a record of the VPS public IP address or addresses; you will enter those exact values at the registrar and in Virtualmin.

Have registrar access and control of the domain

You need permission to create registered hosts or child nameservers at the registrar, not merely permission to edit ordinary DNS records. Registrars use different labels—such as Register nameserver, Child host, Host records or Glue records—but the function is the same. You must also be able to change the domain’s delegated nameserver list.

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

Decide what ns1 and ns2 represent

Two names do not automatically mean two independent DNS systems. If both hostnames resolve to the same VPS, a VPS outage takes both nameservers offline. That arrangement can be suitable for a small deployment or a learning environment, but it is not an independent failure domain. If resilience is a requirement, plan a separate secondary DNS server and use Virtualmin’s secondary-DNS workflow rather than adding a second hostname on the same machine.

Step 1: Prepare the VPS, hostname and primary domain

  1. Install Virtualmin on the supported operating system. Follow the edition-specific prerequisites and installation procedure in the official documentation. Do not start delegation until the server has a stable public IP and the Virtualmin installation is complete.
  2. Set the server hostname. Use a proper fully qualified hostname and confirm that the VPS provider and operating system report the same name. A hostname typo makes later DNS checks difficult to interpret.
  3. Choose the primary domain. In the example, that is example.com. Ensure you can edit its registrar account and that its DNS can eventually point at the VPS.
  4. Record the intended addresses. Write down the public IP for ns1.example.com and the public IP for ns2.example.com. They may be separate addresses or, in a basic single-VPS setup, addresses that terminate on the same machine; whichever values you choose must be used consistently everywhere.

Step 2: Register ns1 and ns2 as child nameservers at the registrar

This is the glue-record step, and it cannot be completed inside Virtualmin. Virtualmin’s DNS troubleshooting documentation explicitly notes that the registrar controls glue records. Log in to the registrar, open the domain’s host or child-nameserver management screen, and create both entries.

  1. Create a host named ns1.example.com and assign its intended public IP address.
  2. Create a host named ns2.example.com and assign its intended public IP address.
  3. Save the host records and check the spelling of every label. A missing dot, an extra space or a different domain suffix creates a different hostname.
  4. In the registrar’s nameserver or delegation screen, select ns1.example.com and ns2.example.com as the nameservers for example.com.

Some registrars require you to save the child hosts first and return to a separate delegation page; others present both actions together. Follow the labels in your registrar’s interface, but do not substitute ordinary A-record editing for child-host registration. The two operations solve different parts of the delegation process.

Step 3: Add matching A records in Virtualmin

After registering the hosts, create the corresponding records in the authoritative zone on the VPS. In Virtualmin, open the primary domain and use DNS Settings → DNS Records.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Choose the option to add an A record.
  2. Enter the hostname for ns1.example.com exactly as it appears in the registrar host entry, and enter the same public IP assigned to that host.
  3. Add a second A record for ns2.example.com with the second registrar-assigned IP.
  4. Save the zone and review the resulting records for spelling and address errors.

The registrar’s glue IP and each Virtualmin A record must agree. If the registrar says that ns1.example.com is at one address while the zone served by Virtualmin says it is at another, different resolvers can follow different paths and return an error. The same rule applies to ns2.example.com.

Check the zone’s NS records as well

The zone should advertise the same nameserver names that you delegated at the registrar. If the registrar delegates ns1.example.com and ns2.example.com but the zone still publishes an old provider name, the delegation and the authoritative answer disagree. Review the NS records in the DNS Records page and correct the names there if necessary.

Step 4: Set Virtualmin’s nameserver template for new domains

Virtualmin uses a server template to decide which nameserver set is written when you create additional virtual servers. Configure the default template so future domains receive your branded names.

  1. Open System Settings → Server Templates.
  2. Edit Default Settings.
  3. Open the DNS domain section.
  4. Set Primary DNS server hostname to ns1.example.com.
  5. In Additional manually configured nameservers, enter ns2.example.com.
  6. Save the template.

This template controls the NS set written for newly created hosted domains. It does not register child hosts at the registrar; that remains a registrar-side task. When you add a new domain later, confirm that its generated NS records contain the names you expect before changing that domain’s delegation.

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.

Step 5: Verify all three DNS layers

Do not rely on a single browser lookup. Check registrar data, delegated NS records and address resolution separately. Virtualmin’s DNS troubleshooting guide documents the following commands; run them from a shell with the host and whois utilities installed.

Inspect registrar-side information

Run:

whois example.com

Look for the domain’s current nameserver delegation and, where the registrar exposes it, the registered host or child-nameserver information. The exact output format depends on the registry and registrar, so treat the command as a way to confirm the names in use rather than as a fixed parser target.

Ask for the delegated NS set

Run:

host -t NS example.com

The answer should list the intended nameserver hostnames, such as ns1.example.com and ns2.example.com. If old names appear, the delegation has not been changed, the change has not propagated to the resolver you queried, or the registrar saved a different set than intended.

Resolve the domain normally

Run:

host example.com

This confirms that the domain is returning address data through the normal resolution path. It does not by itself prove that both custom nameservers are healthy, so perform the direct test next.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Query through the nameserver directly

Run:

host example.com ns1.example.com

Repeat with ns2.example.com if needed. A successful response demonstrates that the named server can answer for the domain. Compare the returned address and authority information with the records you entered in Virtualmin.

Propagation: what to expect after a correct change

Virtualmin states that DNS changes may take from a few hours up to 48 hours to propagate. That is vendor guidance, not a universal guarantee: different recursive resolvers may refresh at different times. During that window, one network may show the new delegation while another still shows the old nameservers.

Keep the old service available if you are migrating an established domain and can do so safely. Test from more than one network or resolver, but do not keep changing records simply because one lookup is stale. First establish whether the authoritative data is correct; then allow caches to expire.

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

Why custom nameservers return SERVFAIL

SERVFAIL means the resolver could not obtain a usable authoritative answer. With a new Virtualmin nameserver setup, the cause is usually a disagreement between registrar glue, delegation and the zone served by BIND.

Glue IP and Virtualmin A record do not match

Symptom: host -t NS example.com lists the right names, but queries through those names fail or work only from some locations.

Fix: Compare the IP assigned to each child host at the registrar with the A record for the same hostname in Virtualmin. Correct whichever side is wrong so that ns1 and ns2 resolve to the registrar-registered addresses. Re-run the direct host tests after the correction.

The delegated NS set and the zone NS set differ

Symptom: The registrar delegates one pair, while the zone’s NS records contain an old name, a typo or only one of the pair.

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

Fix: Make the delegated names and the zone’s NS records identical. Then verify that the corresponding A records exist for every nameserver name. Virtualmin’s documentation summarizes the requirement as alignment between NS records and glue records.

The registrar change has not propagated

Symptom: One resolver still returns the previous nameserver set shortly after you saved the change.

Fix: Confirm the registrar account shows the intended delegation and wait through the propagation period. Virtualmin’s estimate is a few hours to up to 48 hours. A stale answer during that interval is not proof that the final configuration is wrong.

The template was changed, but a new domain still has different NS records

Symptom: The primary domain works, but a newly created virtual server advertises the registrar’s defaults or an old nameserver.

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

Fix: Reopen System Settings → Server Templates → Default Settings → DNS domain. Confirm that Primary DNS server hostname is ns1.example.com and that ns2.example.com appears under Additional manually configured nameservers. The template affects how new hosted domains are generated; it does not perform registrar delegation for them.

Both nameserver names point to one failed VPS

Symptom: The records are internally consistent, but DNS stops answering whenever the VPS or its network connection is unavailable.

Fix: Add an independent secondary DNS server. Renaming the same VPS or creating another hostname on it does not create a separate failure domain.

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

Adding an independent secondary DNS server

For resilience beyond one VPS, use Virtualmin’s documented secondary-DNS workflow. The relevant instructions are in How to Configure Secondary DNS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Open Webmin’s Servers → BIND DNS Server → Cluster Secondary Servers workflow.
  2. Configure the remote secondary server and enable creation of secondary zones.
  3. In the BIND module configuration on the primary server, set the primary server’s external IP address as required by the workflow.
  4. Create or synchronize the secondary zones, then verify that the secondary answers for the same domains.
  5. Update the domain’s NS set only after both the primary and secondary arrangements are correctly configured.

The exact transfer settings depend on the secondary server and your security policy, so use the options shown by the BIND module rather than copying settings from an unrelated provider. The important architectural difference is that the secondary must run on another server or service; two names on one VPS remain one failure domain.

Single VPS versus independent secondary

Decision factor Both branded names on one Virtualmin VPS Virtualmin primary plus independent secondary
Failure independence None if both names terminate on the same VPS Improved because the secondary is outside the primary VPS failure domain
Setup complexity Registrar glue, Virtualmin records and template configuration Those steps plus BIND cluster and secondary-zone configuration
Branded nameserver control Direct control of the local ns1/ns2 records Still requires matching branded delegation and correctly configured secondary data
Cost Not stated; depends on your VPS and registrar Not stated; depends on the independent secondary service or server

A repeatable checklist for each hosted domain

Use this sequence whenever you create a domain that should use the custom nameservers:

  1. Confirm that ns1.example.com and ns2.example.com remain registered child hosts at the registrar.
  2. Confirm that their registrar IP addresses still match the A records in the authoritative Virtualmin zone.
  3. Check that the domain’s zone contains NS records for both branded names.
  4. Check the Virtualmin server template before creating the domain so the generated NS set is correct.
  5. Create the virtual server and inspect its DNS Records page.
  6. Delegate the new domain at its registrar to the same nameserver set.
  7. Run host -t NS your-new-domain.example, host your-new-domain.example and a direct query through each nameserver.
  8. Allow for propagation before treating a stale response as a configuration failure.

Changing an IP address later

An IP change must be coordinated across the registrar and Virtualmin. Update the child-host address at the registrar and the matching A record in the Virtualmin zone, then verify the delegated NS set and direct queries. Leaving one side unchanged recreates the glue-to-A mismatch that causes resolution failures. If you operate an independent secondary, update the primary and secondary configuration according to the BIND cluster workflow before relying on the new address.

Final verification standard

The setup is complete when the registrar shows both registered hosts, the domain delegation lists the same two names, the Virtualmin zone publishes matching NS and A records, and direct host queries receive authoritative answers. Keep the template configured for future domains, and use an independent secondary when availability must survive a failure of the Virtualmin VPS.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair 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.