Проверка работы dns linux

8 Linux Nslookup Commands to Troubleshoot DNS (Domain Name Server)

nslookup is a command-line administrative tool for testing and troubleshooting DNS servers (Domain Name Server). It is used to query specific DNS resource records (RR) as well. Most operating systems come with a built-in nslookup feature.

This article demonstrates the widely used nslookup command in detail. Nslookup can be run in two modes: Interactive and Non-Interactive.

The Interactive mode is used to query DNS-Server about various domains and hosts. Non-Interactive mode is used to query about information of a domain or host.

You might also be interested in the following article :

1. Find out “A” record (IP address) of Domain

# nslookup yahoo.com Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: Name: yahoo.com Address: 72.30.38.140 Name: yahoo.com Address: 98.139.183.24 Name: yahoo.com Address: 209.191.122.70

Above command query domain www.yahoo.com with 4.2.2.2 public DNS server and below section shows Non-authoritative answer: displays A record of www.yahoo.com

2. Find out Reverse Domain Lookup

# nslookup 209.191.122.70 Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: 70.122.191.209.in-addr.arpa name = ir1.fp.vip.mud.yahoo.com. Authoritative answers can be found from:

3. Find out specific Domain Lookup.

# nslookup ir1.fp.vip.mud.yahoo.com. Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: Name: ir1.fp.vip.mud.yahoo.com Address: 209.191.122.70

4. To Query MX (Mail Exchange) record.

# nslookup -query=mx www.yahoo.com Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: www.yahoo.com canonical name = fd-fp3.wg1.b.yahoo.com. fd-fp3.wg1.b.yahoo.com canonical name = ds-fp3.wg1.b.yahoo.com. ds-fp3.wg1.b.yahoo.com canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com. ds-any-fp3-lfb.wa1.b.yahoo.com canonical name = ds-any-fp3-real.wa1.b.yahoo.com. Authoritative answers can be found from: wa1.b.yahoo.com origin = yf1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 1344827307 refresh = 30 retry = 30 expire = 86400 minimum = 1800

MX record is being used to map a domain name to a list of mail exchange servers for that domain. So that it tells that whatever mail received/sent to @yahoo.com will be routed to the mail server.

5. To query NS(Name Server) record.

# nslookup -query=ns www.yahoo.com Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: www.yahoo.com canonical name = fd-fp3.wg1.b.yahoo.com. fd-fp3.wg1.b.yahoo.com canonical name = ds-fp3.wg1.b.yahoo.com. ds-fp3.wg1.b.yahoo.com canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com. ds-any-fp3-lfb.wa1.b.yahoo.com canonical name = ds-any-fp3-real.wa1.b.yahoo.com. Authoritative answers can be found from: wa1.b.yahoo.com origin = yf1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 1344827782 refresh = 30 retry = 30 expire = 86400 minimum = 1800

6. To query SOA (Start of Authority) record.

# nslookup -type=soa www.yahoo.com Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: www.yahoo.com canonical name = fd-fp3.wg1.b.yahoo.com. fd-fp3.wg1.b.yahoo.com canonical name = ds-fp3.wg1.b.yahoo.com. ds-fp3.wg1.b.yahoo.com canonical name = ds-any-fp3-lfb.wa1.b.yahoo.com. ds-any-fp3-lfb.wa1.b.yahoo.com canonical name = ds-any-fp3-real.wa1.b.yahoo.com. Authoritative answers can be found from: wa1.b.yahoo.com origin = yf1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 1344827965 refresh = 30 retry = 30 expire = 86400 minimum = 1800

7. To query all Available DNS records.

# nslookup -query=any yahoo.com Server: 4.2.2.2 Address: 4.2.2.2#53 Non-authoritative answer: yahoo.com origin = ns1.yahoo.com mail addr = hostmaster.yahoo-inc.com serial = 2012081016 refresh = 3600 retry = 300 expire = 1814400 minimum = 600 Name: yahoo.com Address: 98.139.183.24 Name: yahoo.com Address: 209.191.122.70 Name: yahoo.com Address: 72.30.38.140 yahoo.com mail exchanger = 1 mta7.am0.yahoodns.net. yahoo.com mail exchanger = 1 mta5.am0.yahoodns.net. yahoo.com mail exchanger = 1 mta6.am0.yahoodns.net. yahoo.com nameserver = ns3.yahoo.com. yahoo.com nameserver = ns4.yahoo.com. yahoo.com nameserver = ns2.yahoo.com. yahoo.com nameserver = ns8.yahoo.com. yahoo.com nameserver = ns1.yahoo.com. yahoo.com nameserver = ns6.yahoo.com. yahoo.com nameserver = ns5.yahoo.com. Authoritative answers can be found from:

8. Enable Debug mode

To enable Debug Mode ‘set debug’ will return you verbose information like TTL, here’s the output.

# nslookup -debug yahoo.com > set debug > yahoo.com Server: 4.2.2.2 Address: 4.2.2.2#53 ------------ QUESTIONS: yahoo.com, type = A, ANSWERS: -> yahoo.com internet address = 72.30.38.140 ttl = 1523 -> yahoo.com internet address = 98.139.183.24 ttl = 1523 -> yahoo.com internet address = 209.191.122.70 ttl = 1523 AUTHORITY RECORDS: ADDITIONAL RECORDS: ------------ Non-authoritative answer: Name: yahoo.com Address: 72.30.38.140 Name: yahoo.com Address: 98.139.183.24 Name: yahoo.com Address: 209.191.122.70

In this article, we have tried to cover nslookup commands which may help you to search (DNS) Domain Name Service-related information.

Читайте также:  Как посмотреть путь папки linux

The next article will be on the Linux dig command which is similar to nslookup. If you liked the article please share it with your friends and don’t forget to give your valuable feedback through the comment box.

Источник

6 Useful Tools to Troubleshoot DNS Name Resolution Problems

DNS (Domain Name System) is the phonebook of the internet. A Domain name is a unique alphanumeric address that users type in the URL bar in the browser in order to access a website.

Domain names enable users to access a website instead of using an IP address that maps onto every domain name. Sometimes, you may encounter DNS issues such as a misconfigured DNS server which might lead to downtime.

In this guide, we look at 6 tools you can leverage to troubleshoot DNS Name resolution problems in Linux.

1. Nslookup Command

The good old nslookup command has been around for a while. It’s a command-line tool that queries and provides detailed information about the internet domain name servers.

You would typically use the nslookup tool to obtain DNS records of a domain name such as the mapping between a domain name and its associated IP address. The information obtained from querying a DNS record is valuable in troubleshooting DNS-related issues.

To retrieve information about a DNS record, use the following syntax:

For example, to check the DNS record of a domain called linuxtechwhiz.info, run the command:

$ nslookup linuxtechwhiz.info

If everything is okay, you should get output that resembles what we have here.

Check Domain DNS in Linux

The first section displays information about the server used to obtain the DNS records. In this case, it is the local DNS server on my local network. Sometimes, this might be your router or an internal corporate server.

Читайте также:  Запустить видеокарту amd linux

The second section displays the Fully Qualified Domain name and its corresponding IP address (Both IPv4 and IPv6). In some cases, like ours, IPv4 is the only active protocol.

For some domain names, both protocols are enabled. For example, if you query google.com, you find that the domain name maps to multiple IP addresses, both IPv4 and IPv6.

Query Domain DNS in Linux

2. dig Command

Short for Domain Information Groper, dig is yet another command-line tool for querying Domain Name System (DNS) name servers. It’s a better DNS query tool and replaced the nslookup command.

The dig command allows you to perform DNS lookups and provide intricate details about various DNS records including A, MX, and SOA records.

The most straightforward way of probing a DNS record is by typing the dig command followed by the domain name and pressing ENTER.

Query Domain DNS Info in Linux

The output of the dig command is quite verbose. To display the IP address mapping include the +short suffix as shown.

$ dig linuxtechwhiz.info +short 74.207.227.36 

3. host Command

The host command is another handy tool you can use to handle manual DNS resolution. For example, you can perform a DNS forward lookup as shown.

Check DNS Forward Lookup

You can also perform a reverse lookup as follows.

Check DNS Reverse Lookup

The -C option lets you query for the SOA records.

Check DNS SOA Records

In addition, you can query for the MX records using the -t mx flags as shown.

Check DNS MX Records

To display all the information about a domain, pass the -a flag as shown.

Check Domain DNS Info

4. ping Command

The ping command is mostly used to check the availability or reachability of a system or node.

You can test the connectivity of a domain name by pinging the domain as shown.

$ ping linuxtechwhiz.info -c 4

A positive response implies that the name resolution is working as expected. An error points to a DNS resolution issue.

Moreover, you can ping the remote IP associated with the domain name to check if the system hosting your name is up and reachable.

Ping Remote Linux Host

The command-line tools that we have just looked at only provide limited information about your DNS records and cannot adequately be used to troubleshoot complex DNS issues.

5. MXToolBox

MXToolBox is a free online tool (paid for extra features) that provides fast and accurate network diagnostic and DNS lookup tools.

It provides you with a comprehensive outlook of your domain health, which includes monitoring your domain, displaying information about any DNS or IP blacklists, probing the email server for any issues, checking the web server, and running over 15 tests on your DNS server.

It’s a highly recommended tool if your sole purpose is to get to the bottom of any DNS-related issue.

MxToolbox - MX Lookup Tool

6. IntoDNS

IntoDNS is another valuable tool that you can use to check and troubleshoot any DNS-related issues. In just a few seconds, it generates a detailed report about NS records, nameservers, SOA and MX records, TTL, refresh interval, and much more.

In addition, it provides information about mail servers’ IP address and their validity and any possible problem with your domain name.

Читайте также:  Linux удалить переменную окружения

IntoDNS - Checks DNS Servers

Closing Thoughts

These are just a few tools that provide insights into your DNS records which come in handy in troubleshooting any faults or errors associated with your domain. We hope you found this guide insightful. Feel free to reach out with any comments or feedback.

Источник

3 Ways to check DNS server IP in Linux

DNS servers are an important part of the internet, translating domain names into IP addresses. If your DNS server is not working correctly, you may experience problems loading websites or sending and receiving email. In this blog post, we will discuss three ways to check your DNS server in Linux. We will also provide some tips for troubleshooting DNS problems. Let’s get started!

Check DNS server IP with Dig command in Linux

The best way to check your DNS server is to use the ‘dig’ command. The ‘dig’ command allows you to query DNS servers for information about domains. To use the ‘dig’ command, open a terminal and type the following: dig example.com

This will query the DNS server for information about the domain “example.com”. For example, if you want to query for A records, you would type the following: dig example.com +short

You can replace “example.com” with any domain you want to query. From the following example, we can see that the DNS server is 64.104.76.247 .

dig howtouselinux.com
; > DiG 9.10.6 > howtouselinux.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;howtouselinux.com. IN A
;; ANSWER SECTION:
howtouselinux.com. 0 IN A 162.159.137.9
howtouselinux.com. 0 IN A 162.159.138.9
;; Query time: 138 msec
;; SERVER: 64.104.76.247#53(64.104.76.247)
;; WHEN: Wed Mar 02 21:24:01 CST 2022
;; MSG SIZE rcvd: 78

Check DNS server IP with nslookup command in Linux

The second way to check your DNS server is to use the ‘nslookup’ command. ‘Nslookup’ is a tool that allows you to query DNS servers for information about domains. To use the ‘nslookup’ command, open a terminal and type the following: nslookup example.com

This will query the DNS server for information about the domain “example.com”. You can also query specific records by using the ‘querytype’ parameter. For example, if you want to query for A records, you would type the following: nslookup -query=a example.com

The dns server is 64.104.76.247 from the following example.
% nslookup -query=a howtouselinux.com
Server: 64.104.76.247
Address: 64.104.76.247#53
Non-authoritative answer:
Name: howtouselinux.com
Address: 162.159.137.9
Name: howtouselinux.com
Address: 162.159.138.9

Check DNS server IP with /etc/resolv.conf file in Linux

The third way is to check /etc/resolv.conf configuration file. It contains DNS server information we use.

cat /etc/resolv.conf
domain howtouselinux.com
nameserver 64.104.76.247
nameserver 64.104.76.248

We hope this blog post has been helpful in showing you how to check your DNS server in Linux. If you are experiencing DNS problems, be sure to try using these three commands to troubleshoot the issue. Thanks for reading!

Источник

Оцените статью
Adblock
detector