What is Nameserver Lookup and How to Change NS
An ns lookup is a diagnostic process used to query the Domain Name System (DNS) to find which authoritative nameservers are currently responsible for a specific domain name. When you type a website address into your browser, a query is initiated to discover these nameservers, which in turn point to the correct hosting server IP address. Without this mapping, human-readable domain names like example.com could not translate into machine-readable network destinations.
Understanding how to perform an ns lookup and how to change your nameservers (NS records) is an essential skill for managing domains, migrating websites, and troubleshooting connectivity issues. Whether you are launching a new site or switching providers, knowing how DNS delegation works saves you hours of frustrating downtime.
To check your domain's current delegation instantly without messing with command-line tools, you can use the NS Lookup tool on XiaTools, which queries global root and authoritative servers to show you exact record propagation.
How Nameservers Work Behind the Scenes
When a user enters a domain name into an address bar, the recursive resolver (usually operated by an ISP or a public DNS provider like 1.1.1.1) embarks on a journey to find the content. It starts at the root DNS servers, moves down to the Top-Level Domain (TLD) servers (such as .com), and finally lands on the authoritative nameservers specified for that exact domain.
Your NS records define where this final authority lies. If your domain is registered at Registrar A but hosted at Web Host B, your registrar needs to have the NS records of Web Host B configured so that the rest of the internet knows where to ask for your A, AAAA, and MX records.
The Anatomy of an NS Record
An NS record is simple in structure. It contains a domain name and the hostname of the authoritative server. Here is what standard NS records look like in a zone file:
example.com. 86400 IN NS ns1.hostingprovider.com.
example.com. 86400 IN NS ns2.hostingprovider.com.
- TTL (Time to Live): The value
86400represents seconds (24 hours), telling resolvers how long to cache this record. - Class:
INstands for Internet. - Type:
NSspecifies that this is a nameserver record. - Target: The fully qualified domain name of the nameserver.
How to Perform an NS Lookup
You can query nameservers using various built-in command-line utilities across operating systems, or via web-based network toolkits. Here is how to inspect NS records using common administrative tools.
Using nslookup on Windows and Linux
The traditional nslookup command is available natively in Windows PowerShell, Command Prompt, and Linux terminals. To query the NS records of a domain interactively or directly, follow these steps:
- Open your terminal or PowerShell window.
- Type
nslookupand press Enter to enter interactive mode, or run a direct query. - Set the query type to NS by typing
set type=NS. - Enter the domain name you wish to check, such as
example.com.
PS C:\Users\Admin> nslookup
> set type=NS
> example.com
Server: dns.google
Address: 8.8.8.8
Non-authoritative answer:
example.com nameserver = ns1.example.net
example.com nameserver = ns2.example.net
Using dig for Advanced DNS Queries
Network engineers prefer the dig (Domain Information Groper) utility for its detailed output and accuracy. To find the nameservers using dig, use the following command:
dig example.com NS +noall +answer
Sample output:
example.com. 3600 IN NS ns1.example.net.
example.com. 3600 IN NS ns2.example.net.
Step-by-Step Guide: How to Change Your Nameservers
Changing your nameservers moves the authority of your DNS zone from one provider to another (for example, moving from your domain registrar's default nameservers to a cloud DNS provider or a new web host).
Note: Exact menu names and paths differ slightly depending on your specific registrar (such as GoDaddy, Namecheap, Cloudflare, or Route53), but the general workflow remains identical.
Step 1: Gather Your New Nameserver Addresses
Before making any changes, obtain the exact hostnames provided by your new hosting or DNS provider. They usually look like:
ns1.newhostdns.comns2.newhostdns.com
Step 2: Log In to Your Domain Registrar
Navigate to the company where you originally purchased and registered your domain name. Log into your account dashboard and locate the Domain Portfolio, My Domains, or Domain Management section.
Step 3: Locate the DNS or Nameserver Settings
Click on the specific domain name you want to update. Look for a tab or card labeled Nameservers, DNS Settings, or Manage DNS.
Step 4: Switch from Default to Custom Nameservers
Most registrars default to using their own parking or default nameservers.
- Select the option that says Custom Nameservers or Use custom nameservers.
- Enter your new nameserver hostnames into the provided fields (add a third or fourth field if your provider gave you more).
- Save or apply your changes.
Step 5: Verify the Propagation
Once updated, global recursive resolvers need time to notice the change. You can verify that the update is propagating by running an ns lookup or using an online propagation checker.
Comparison: Registrar Nameservers vs. External DNS Providers
| Feature | Registrar Default NS | Dedicated DNS Provider | Cloud / CDN NS |
|---|---|---|---|
| Setup Difficulty | None (Automatic) | Low | Medium |
| Propagation Speed | Moderate to Slow | Fast | Instant (Internal) |
| Advanced Records | Basic (A, CNAME, MX) | Advanced (SRV, CAA, TLSA) | Security & Edge Rules |
| DDoS Protection | Minimal | Standard | Enterprise-Grade |
Common Mistakes and How to Fix Them
Even experienced engineers occasionally run into configuration snags when updating nameservers. Avoid these frequent pitfalls:
- Forgetting to copy all records first: When you change nameservers, your domain stops using your old zone file instantly. If you had custom MX records (for email) or TXT records (for SPF/DKIM/DMARC) on the old nameserver, your email and verification checks will break unless you recreate those exact records on the new nameserver before switching.
- Entering IP addresses instead of hostnames: Nameserver fields require fully qualified domain names (like
ns1.example.com), not raw IP addresses (like192.0.2.1), unless you are configuring glue records for a custom nameserver setup under your own domain. - Expecting instant global updates: DNS relies on caching. Even after you update your NS records at your registrar, internet service providers worldwide will continue serving the old cached data until the old TTL expires. This propagation window can take anywhere from 2 to 48 hours.
- Typos in nameserver spellings: A single character typo in
ns1.newhostdns.comwill cause total resolution failure for your domain, rendering your website completely unreachable.
Quick Checklist for Nameserver Migration
- Inventory all existing DNS records (A, CNAME, MX, TXT, SRV) at your current provider.
- Recreate all necessary records inside your new hosting or DNS control panel.
- Obtain the exact 2 or more nameserver hostnames from your new provider.
- Log into your domain registrar and update the NS settings to custom.
- Verify the update using an ns lookup tool after a few minutes.
- Monitor email deliverability and web traffic to ensure zero disruption.