Loading...

How to fetch the nameservers of a domain?

question networking linux
Ram Patra Published on July 19, 2024

To get the nameservers of a domain, you can use the nslookup or dig command-line tools. Both are available on most Unix-like operating systems, including Linux and macOS. On Windows, nslookup is available by default.

Using nslookup

nslookup -type=ns example.com

Using dig

dig ns example.com

Using host

host -t ns example.com

Explanation

  • nslookup -type=ns example.com: This command uses nslookup to query the DNS records for the specified domain (example.com) and returns the nameserver (NS) records.

  • dig ns example.com: This command uses dig to perform a DNS lookup for the nameserver records of the specified domain.

  • host -t ns example.com: This command uses host to query the nameserver records for the specified domain.

Example Output

Here’s an example output using dig:

; <<>> DiG 9.10.6 <<>> ns example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18303
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;example.com.			IN	NS

;; ANSWER SECTION:
example.com.		86400	IN	NS	ns1.example.com.
example.com.		86400	IN	NS	ns2.example.com.
example.com.		86400	IN	NS	ns3.example.com.
example.com.		86400	IN	NS	ns4.example.com.

;; ADDITIONAL SECTION:
ns1.example.com.	172800	IN	A	192.0.2.1

;; Query time: 38 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Jul 18 14:55:15 EDT 2024
;; MSG SIZE  rcvd: 118

This output shows the nameservers (ns1.example.com, ns2.example.com, etc.) for the domain example.com.

Presentify

Take your presentation to the next level.

FaceScreen

Put your face and name on your screen.

ToDoBar

Your to-dos on your menu bar.

Ram Patra Published on July 19, 2024
Image placeholder

Keep reading

If this article was helpful, others might be too

question networking as2 May 24, 2024 Basics of AS2 protocol with sample code to send and receive messages

AS2 (Applicability Statement 2) is a widely-used protocol for secure and reliable data exchange over the Internet. It’s particularly popular in business-to-business (B2B) transactions where security, authentication, and non-repudiation (the inability to deny having sent a message) are crucial. Here’s a breakdown of its basics along with some TypeScript code demonstrating sending and receiving messages with acknowledgment receipts.

February 20, 2022 Mesh WiFi vs WiFi Repeater/Extender vs Powerline Adapter

Broadband speed at home is more vital than ever as most of us are working from home and if your workstation is away from the router then unfortunately you may not be getting the full speed that you paid your ISP for. Ergo, in this post, we would see 3 different ways to improve that and which one is the best.