How to Create Custom Nameservers and Glue Records in Namecheap

by Fahim Mahmud Chisti

Custom nameservers such as ns1.example.com let your domain answer from DNS servers you run yourself. In Namecheap you create them by registering glue records (Namecheap calls the feature Personal DNS Server) and then switching the domain to Custom DNS. By the end of this guide, your domain resolves through your own ns1 and ns2, and you have checked the delegation with dig.

Quick answer: Register ns1 and ns2 with their IP addresses under Advanced DNS > Personal DNS Server, make your own DNS server answer for the zone, then set the domain’s nameservers to Custom DNS.

  1. Run an authoritative DNS server on two public IP addresses.
  2. In Namecheap, open Domain List > Manage > Advanced DNS > Personal DNS Server and add ns1 and ns2 with their IPs.
  3. Add matching NS and A records for ns1 and ns2 to your own zone file, plus every record the domain already uses.
  4. On the Domain tab, switch Nameservers to Custom DNS and enter ns1.example.com and ns2.example.com.
  5. Check the glue with dig @a.gtld-servers.net example.com NS +norecurse.
In this guide
  1. Why Custom Nameservers Need Glue Records
  2. Before You Start
  3. Step 1: Register Glue Records in Namecheap (Personal DNS Server)
  4. Step 2: Configure Zone Records on Your Authoritative Server
  5. Step 3: Switch Domain Nameservers to Custom DNS
  6. Step 4: Verify Delegation and Glue Records with Dig
  7. If It Still Doesn’t Work
  8. Frequently Asked Questions
  9. Next Steps
How to Create Custom Nameservers and Glue Records in Namecheap

Why Custom Nameservers Need Glue Records

When your domain uses nameservers named under that same domain, resolvers hit a chicken-and-egg problem. If example.com hands its DNS to ns1.example.com, a resolver can’t find the address of ns1.example.com without first asking example.com‘s nameserver, which is ns1.example.com itself.

A glue record breaks that loop. It is an A (or AAAA) record stored at the Top-Level Domain (TLD) registry, the organisation that runs .com or .net, right next to your domain’s NS delegation. It hands resolvers the nameserver’s IP address up front.

Here is what happens during a query for app.example.com:

  1. The resolver queries the root DNS servers for .com.
  2. The root server returns the .com TLD nameservers.
  3. The resolver asks the .com TLD server for example.com.
  4. The TLD server replies: “The authoritative nameserver is ns1.example.com.”

If the TLD server only returns the hostname ns1.example.com without an IP, the resolver has to resolve ns1.example.com first. But to do that, it has to ask ns1.example.com. Infinite loop. As defined in IETF RFC 1034, the parent zone must supply the nameserver’s IP inside the DNS response’s “Additional Section”. That IP is your glue record.

Before You Start

Check these before you touch the registrar dashboard:

  • Two static public IPs: RFC specs require at least two nameservers for redundancy (like ns1.example.com and ns2.example.com), ideally on separate subnets or VPS instances.
  • A working authoritative DNS server: BIND9, PowerDNS, Knot DNS, or a control panel (cPanel, CyberPanel) listening on port 53 (UDP and TCP) on those IPs. “Authoritative” means it holds the master copy of your zone and answers for it.
  • Namecheap login: access to the account that holds the domain. Glue records can only be created at the registrar of the domain that names the nameservers.
  • A copy of your current DNS records: copy or screenshot every row in Advanced DNS (A, CNAME, MX, TXT). Once the domain uses Custom DNS, Namecheap no longer serves those records. Anything missing from your own zone file stops resolving, and email breaks first if the MX and SPF records are left behind.
  • Time: about 30 minutes of work. The registry usually publishes glue quickly, but resolvers that cached the old delegation can keep it for up to 48 hours.
  • Rollback: if something breaks, set Nameservers back to Namecheap BasicDNS on the Domain tab and check your host records against the copy you made.

Only need a website or one subdomain on your VPS? You don’t need custom nameservers for that. An A record in Namecheap BasicDNS does the job; see how to route subdomains to different servers in Namecheap DNS.

Step 1: Register Glue Records in Namecheap (Personal DNS Server)

Namecheap doesn’t label this feature “Glue Records” anywhere in the UI. Instead, it lives under Advanced DNS labeled as Personal DNS Server.

Here is how to register the records at the registry level:

  1. Log in to Namecheap and head to your Domain List.
  2. Click Manage next to your root domain.
  3. Open the Advanced DNS tab.
  4. Scroll down to Personal DNS Server.
  5. Choose standard or custom nameservers in the dropdown and click Add Nameserver.
  6. In the Nameserver field, enter the hostname prefix, for example ns1.
  7. Enter the public IPv4 address of your primary nameserver in the IP Address field.
  8. Click Done (the green checkmark) to save.
  9. Repeat for ns2 using your secondary nameserver IP.

Namecheap’s interface only accepts IPv4 addresses here. To register IPv6 (AAAA) glue records, you have to contact Namecheap support.

Step 2: Configure Zone Records on Your Authoritative Server

Registering glue records pushes your nameserver IPs to the TLD registry (like Verisign for .com). Your own DNS server must also publish matching NS and A records in its zone file. If the zone file and the glue records disagree, resolvers can drop queries or fail unpredictably.

On your DNS server, a minimal BIND9 zone file (here /etc/bind/zones/db.example.com) looks like this. Replace the example IPs with yours, and add every other record the domain uses, including MX and TXT records for email:

$TTL 86400
@   IN  SOA ns1.example.com. admin.example.com. (
        2026091901 ; Serial
        3600       ; Refresh (1 hour)
        1800       ; Retry (30 mins)
        1209600    ; Expire (2 weeks)
        86400 )    ; Minimum TTL (1 day)

; Define Authoritative Nameservers
@   IN  NS  ns1.example.com.
@   IN  NS  ns2.example.com.

; Glue / Host A Records for Nameservers
ns1 IN  A   198.51.100.10
ns2 IN  A   198.51.100.11

; Apex and Web Hosts
@   IN  A   203.0.113.50
www IN  CNAME example.com.

Increment the serial number every time you edit the zone file. Then, on the DNS server over SSH, check the file and reload BIND:

sudo named-checkzone example.com /etc/bind/zones/db.example.com
sudo systemctl reload bind9

named-checkzone should print a line like zone example.com/IN: loaded serial 2026091901 followed by OK. If it prints an error instead, fix the line it names before you reload. On some distributions the service is called named rather than bind9.

Before you go further, ask your server directly from your own computer whether it answers for the zone:

dig @198.51.100.10 example.com SOA +norecurse

The flags: line of the output should include aa (authoritative answer), and the ANSWER SECTION should show your SOA record. If you see status: REFUSED or no aa flag, the zone is not loaded on that server yet. Fix that first, or the domain will stop resolving when you switch nameservers.

If you’re using PowerDNS with MySQL or PostgreSQL, insert the corresponding rows into the records table for both NS entries and the A records for ns1 and ns2.

Step 3: Switch Domain Nameservers to Custom DNS

Once your glue records are saved and your DNS server answers with the aa flag, point the domain itself to your new nameservers. From this moment, the records in Namecheap’s Advanced DNS stop being used, so confirm that your zone file has everything from the copy you made in Before You Start.

If the domain has email, copy its MX, SPF and DKIM records into your zone first. For Namecheap Private Email, the exact values are in our guide to Namecheap Private Email MX records. For which record types can sit on the root domain, see A record vs CNAME on a root domain.

  1. In Namecheap, switch back to the main Domain tab.
  2. Find the Nameservers section.
  3. Change the dropdown from Namecheap BasicDNS to Custom DNS.
  4. Enter ns1.example.com under Nameserver 1.
  5. Enter ns2.example.com under Nameserver 2.
  6. Click the green checkmark to save.

The registry usually shows the new delegation within minutes. Step 4 shows how to check it instead of guessing.

Step 4: Verify Delegation and Glue Records with Dig

Don’t rely on a browser to verify nameserver changes, because your operating system and browser cache DNS answers. Run these checks in a terminal on your own computer (macOS and Linux include dig; on Windows, use WSL or install the BIND tools). They query the TLD servers directly.

To inspect the glue record returned by the TLD servers for a .com domain, query one of Verisign’s .com TLD servers (like a.gtld-servers.net):

dig @a.gtld-servers.net example.com NS +norecurse

Look at the output structure. You should see your custom nameservers in the AUTHORITY SECTION and their raw IPs in the ADDITIONAL SECTION:

;; AUTHORITY SECTION:
example.com. 172800 IN NS ns1.example.com.
example.com. 172800 IN NS ns2.example.com.

;; ADDITIONAL SECTION:
ns1.example.com. 172800 IN A 198.51.100.10
ns2.example.com. 172800 IN A 198.51.100.11

;; Query time: 14 msec
;; SERVER: 192.5.6.30#53(a.gtld-servers.net)

Those A records in the ADDITIONAL SECTION confirm your glue records are live at the registry. Resolvers can now bootstrap the nameserver lookup without getting stuck in a loop.

Next, trace resolution from the root servers down to your authoritative host:

dig +trace +nodnssec example.com

If the last block of the trace ends with a line like ;; Received 60 bytes from 198.51.100.10#53(ns1.example.com), the final answer came straight from your own server and your custom nameservers are working.

If It Still Doesn’t Work

1. The “Glue Mismatch” Error

A common problem: you change your VPS IP address in your zone file but forget to update the Personal DNS Server section in Namecheap. When that happens:

  • The TLD server serves the old, dead IP in the ADDITIONAL SECTION.
  • Resolvers attempt the old IP first and time out.
  • Queries stall or intermittently fail while resolvers wait for the dead address to time out.

Fix it by updating the IP under Advanced DNS > Personal DNS Server in Namecheap, giving the registry a little time to publish the change, and verifying with dig @a.gtld-servers.net.

2. Port 53 Blocked by Firewall

DNS needs UDP port 53 for standard queries and TCP port 53 for payloads over 512 bytes (plus DNSSEC). Test connectivity from an external machine:

# Test UDP lookup
dig @198.51.100.10 example.com A

# Test TCP lookup
dig @198.51.100.10 example.com A +tcp

If queries hang or time out, open the ports on your server firewall:

sudo ufw allow 53/tcp
sudo ufw allow 53/udp
sudo ufw reload

3. “Nameserver does not exist” Error During Delegation

If you try setting Custom DNS to ns1.example.com and Namecheap throws an error claiming the nameserver is invalid or unregistered, you skipped Step 1. You cannot assign child nameservers under the Domain tab until you register them as Personal DNS Servers first.

4. Website or Email Stopped Working After the Switch

The delegation works, but some names no longer resolve. That almost always means a record from Namecheap’s Advanced DNS never made it into your zone file. Compare your zone with the copy you made before switching, add the missing MX, TXT, A or CNAME records, bump the serial, and reload. Then confirm with dig @198.51.100.10 example.com MX +short, which should print your mail servers.

5. One Nameserver Answers and the Other Doesn’t

If dig @198.51.100.11 example.com SOA +norecurse times out or returns REFUSED while ns1 works, the zone is missing on ns2 or zone transfers between the two servers are failing. Resolvers will retry the working server, but lookups get slower and less reliable. Load the zone on both servers before you rely on them.

Frequently Asked Questions

Can I create glue records for a domain registered elsewhere?

No. Glue records must always be created at the registrar where the domain is registered. If example.com is registered at Namecheap, create the personal DNS server records inside Namecheap. Once created, other domains anywhere on the internet can use ns1.example.com as their nameserver.

How long does it take for Namecheap glue records to propagate?

The registry update itself is usually quick; confirm it with dig @a.gtld-servers.net rather than waiting a fixed time. Resolvers that cached the old delegation keep it until its TTL expires, and TLD delegation TTLs are long (two days for .com), so allow 24 to 48 hours before everyone sees the change.

Do I need separate IP addresses for ns1 and ns2?

Yes, use two different IPs. Many registries let you assign the same IP to both hostnames, but that creates a single point of failure and defeats the purpose of having two nameservers. Some TLDs refuse it outright: Namecheap’s documentation notes that .ca and .nl, among others, require a unique IP for each nameserver.

What is the difference between an A record and a glue record?

A standard A record lives inside your zone file on your authoritative nameserver. A glue record is an A record stored upstream at the TLD registry. It exists only to break the loop for nameservers named inside the domain they serve (DNS people call these “in-bailiwick” nameservers).

Next Steps

Your domain now resolves through your own nameservers, so every DNS change from here happens in your zone file, not in Namecheap. Set up monitoring on both servers, because if both go down, the website and email stop resolving. When a server’s IP changes, update Personal DNS Server in Namecheap the same day. A good next record to add in your new zone is a CAA record that limits which certificate authorities may issue SSL for the domain; see how to configure CAA records to restrict SSL issuance.

all_in_one_marketing_tool