What Are Glue Records in DNS and When Do You Need Them?
What Are Glue Records and Why Do They Matter?
If you’ve ever set up custom nameservers for your domain (like ns1.yourdomain.com and ns2.yourdomain.com), you’ve likely encountered the term glue record. But what exactly are they, and why can’t DNS operate without them in certain cases?
In short, a glue record is a specific type of A record (or AAAA record for IPv6) that a parent DNS zone includes to resolve the IP address of a nameserver that is itself part of the same domain. Without glue records, a DNS resolver would enter an endless loop trying to find the IP of ns1.yourdomain.com when yourdomain.com itself is the zone being queried.
A Simple Analogy
Think of glue records like an emergency contact number you leave at the front desk of a building. If you’re inside a room that doesn’t have a phone, someone outside needs to know how to reach you – the “glue” provides that initial connection. In DNS, the glue record supplies the IP address of your nameserver before the resolver even reaches your domain’s zone.
How Glue Records Solve the Circular Dependency Problem
To understand why glue records are necessary, let’s walk through what happens when a resolver tries to look up www.example.com and the authoritative nameservers are ns1.example.com and ns2.example.com:
- The resolver first contacts the root servers and is directed to the .com TLD authoritative servers.
- The
.comservers know the names ofexample.com's nameservers – in this case,ns1.example.comandns2.example.com– because the registrar provided them during delegation. - Now the resolver needs the IP address of
ns1.example.comto query it. But to look up that IP, it would normally ask theexample.comzone – which is exactly wherens1.example.comlives. That creates a chicken-and-egg problem.
Glue records break this cycle. When the registrar tells the TLD about your nameservers, it also provides A (or AAAA) records for those nameservers. These are stored in the TLD zone as glue records. The resolver can now get the IP of ns1.example.com directly from the .com servers without ever querying example.com first.
When Do You Actually Need Glue Records?
The rule is simple: you need glue records when your domain’s nameservers are hosted within that same domain. For example:
- Your domain is
mydomain.comand your nameservers arens1.mydomain.comandns2.mydomain.com. - You run a web hosting business and set
ns1.myhosting.netfor a domain that is itselfmyhosting.net. - You use a control panel like cPanel that often defaults to server hostnames under your own domain.
If your nameservers are hosted on a different domain (e.g., ns1.cloudflare.com for mydomain.com), no glue records are needed because the resolver can look up cloudflare.com independently.
Real-World Example
Let’s say you register mybiz.com and you want to use ns1.mybiz.com and ns2.mybiz.com as your nameservers. You must go to your registrar and set these as your custom nameservers. The registrar will ask you to provide IP addresses for each. Those IPs become glue records stored in the .com zone. Without them, your domain would never resolve – visitors would get an error because the loop can’t be broken.
How to Set Up Glue Records (Step-by-Step)
Setting up glue records is usually done through your domain registrar. Here’s the typical process:
- Log into your registrar (e.g., GoDaddy, Namecheap, Google Domains).
- Navigate to the “Custom Nameservers” or “DNS Management” section for your domain.
- Enter the hostnames you want as nameservers (e.g.,
ns1.mydomain.com). - Provide the IP addresses for each hostname. These are the glue records.
- Save the changes. The registrar will propagate the glue records to the TLD zone.
Note: If you’re using a provider like Cloudflare, you typically don’t set up glue records yourself – they provide nameservers on their own domain (e.g., aaron.ns.cloudflare.com). But if you’re hosting your own DNS on a VPS or dedicated server, you’ll need to handle glue records manually.
Common Mistakes and How to Avoid Them
- Missing glue records: If you change nameservers but forget to add glue records, your domain will become unreachable. Always verify using a tool like the DNS Analyzer on Whose.Domains, which can show you whether glue records are present.
- Wrong IP addresses: Make sure the IPs you provide for glue records are exactly the IPs of the servers running DNS. A single typo can break resolution. Use a Domain Analyzer to check that the nameserver IPs match what’s in the glue records.
- IPv6 forgot: If your nameservers support IPv6, you should also add AAAA glue records. Most registrars allow this now.
- TTL considerations: Glue records are typically set with a high TTL (e.g., 86400 seconds). If you need to change a glue record IP, expect slow propagation – plan ahead.
Practical Tips for Domain Owners and Administrators
- Audit your glue records regularly: When you migrate servers or change IPs, update the glue records at your registrar. The nameserver hostnames themselves should rarely change, but the IPs may.
- Use separate nameserver hostnames: Avoid using the same hostname for different IPs. For redundancy, have at least two nameservers with distinct hostnames (like
ns1andns2). - Test after setup: Use the DNS Analyzer to run a full DNS health check. It will report whether glue records are missing or inconsistent.
- For domain investors: If you buy a domain with custom nameservers (e.g., a previously used domain), check that the glue records are still valid. You can use a Domain History check to see past nameserver changes.
When Don’t You Need Glue Records?
You don’t need glue records if:
- Your nameservers are hosted on a different domain (e.g.,
ns1.otherhost.comformy.domain). - You use third-party DNS providers like AWS Route 53, Google Cloud DNS, or Cloudflare – they give you nameservers with their own domains.
- Your domain is a TLD itself (like
.comor.org) – those are managed by root servers and don’t use glue records in the same way.
Conclusion
Glue records are a small but critical component of the DNS system. Without them, using your own domain as a nameserver would be impossible. Whether you’re a developer hosting your own DNS, a domain reseller, or just curious about how the internet works, understanding glue records helps you avoid downtime and troubleshoot issues faster.
Take a moment to check your own domains. If you’re running custom nameservers, verify your glue records with a DNS Analyzer. A few minutes of due diligence can save you hours of head-scratching later.