From a client resolver perspective this old TechNet documents:
The DNS Server service in Windows Server 2008 supports Extension Mechanisms for DNS (EDNS0, as defined in RFC 2671), which allow DNS requestors to advertise the size of their UDP packets and facilitate the transfer of packets larger than 512 bytes. When a DNS server receives a request over UDP, it identifies the requestor’s UDP packet size from the option (OPT) resource record and scales its response to contain as many resource records as are allowed in the maximum UDP packet size specified by the requestor
UDP packets are smaller in size. UDP packets can not be greater then 512 bytes. So any application needs data to be transferred greater than 512 bytes require TCP in place. For example, DNS uses both TCP and UDP for valid reasons described below. Note that UDP messages are not larger than 512 Bytes and are truncated when greater than this size. DNS uses TCP for Zone transfer and UDP for name queries either regular (primary) or reverse. UDP can be used to exchange small information whereas TCP must be used to exchange information larger than 512 bytes. If a client doesn’t get response from DNS it must re-transmit the data using TCP after 3-5 seconds of interval.
Let’s contrast the TCP and UDP lookup process. We will resolve the A record in DNS called mail.TailspinToys.ca from a separate environment so the queries are over the Internet. Note that we will query WingtipToys.ca so pay attention to the DNS name.
UDP sockets are “message-oriented sockets” (as opposed to “stream-oriented sockets”; TCP sockets are stream-oriented). This is why the option we enable to use TCP in Nslookup is called the Virtual Circuit (VC) .
Reviewing Standard UDP Nslookup Query
Using standard Nslookup, we query for mail.TailspinToys.ca
This correctly resolves the A record to the external IP of 13.92.177.139 (this is in Azure in case you were curious).
From the network perspective, the queries issued from the resolver to its DNS server are UDP based. You can see this in Wireshark below.
Reviewing TCP Nslookup Query
We will query for the same endpoint, but first the Virtual Circuit option will be enabled with the command:
Note that the option is case sensitive.
Looking at the details for frame 6, we see that TCP is now used for the query’s transport mechanism:
Bootnote
You may have noticed text along the top of the Wireshark window. This indicates that we are capture on an interface called NIC1 and the capture filter is what is shown inside the brackets.
Кроме того, эта команда используется для поиска и устранения проблем с DNS. В данном руководстве мы рассмотрим наиболее типичные примеры ее применения.
Команда nslookup может работать в интерактивном и неинтерактивном режимах. Интерактивный режим позволяет пользователю в режиме диалога отправлять DNS-серверу запросы о различных узлах и доменах. Неинтерактивный режим позволяет отправить один запрос об одном узле или домене.
Наиболее распространенные опции и типы аргументов мы рассмотрим ниже в соответствующих примерах.
Получение IP-адреса домена
$ nslookup yandex.ru
Авторитативный и неавторитативный ответы
В приведенном результате присутствует фраза «Non- Authoritative Answer» (неавторитативный ответ).
Авторитативным считается ответ от DNS-сервера, на котором есть полная информация о зоне домена. Во многих случаях на DNS-серверах такой информации нет, они хранят кэш с результатами прошлых запросов, на которые был получен авторитативный ответ. Когда такой сервер получает запрос, он осуществляет поиск в файле кэша и при наличии необходимых данных отправляет их как неавторитативный ответ, как в рассматриваемых нами примерах.
Запрос записи MX
$ nslookup -query=mx redhat.com
Запрос записи NS
Запись NS (Name Server, сервер имен) содержит соответствие доменного имени DNS-серверу, авторитативному для заданного домена. Ее можно получить при помощи опции -query=ns:
$ nslookup -query=ns yandex.ru
Запрос записи SOA
Запись SOA (Start of Authority, начальная запись зоны) содержит информацию о зоне домена, адрес его администратора, серийный номер и т.д. Ее можно получить при помощи опции -query=soa:
$ nslookup -query=soa yandex.ru
Просмотр всех имеющихся записей DNS
При помощи опции -query=any мы можем просмотреть все записи DNS, которые у нас есть для заданного доменного имени:
$ nslookup -type=any google.com
Обратный поиск DNS
$ nslookup 5.255.255.70
Использование конкретного DNS-сервера
Для разрешения доменного имени можно использовать конкретный сервер имен (в данном случае ns1.redhat.com):
$ nslookup redhat.com ns1.redhat.com
Обратите внимание, что в результате отсутствует фраза «Non-authoritative answer», так как ns1.redhat.com обладает всей информацией о зоне для redhat.com.
Изменение номера порта
По умолчанию DNS-серверы используют порт 53, но при необходимости можно указать другой номер порта посредством опции -port:
$ nslookup port 56 yandex.ru
Изменение интервала ожидания ответа
Интервал ожидания ответа по умолчанию можно изменить, указав желаемое значение в секундах с опцией -timeout:
$ nslookup -timeout=10 google.com
Режим отладки
При помощи опции -debug вы можете включить режим отладки:
$ nslookup -debug redhat.com
В режиме отладки при поиске выводится информация о пакетах.
Интерактивный режим
Для входа в интерактивный режим запустите команду nslookup без опций. Далее можно вводить необходимые имена или адреса, а также устанавливать парметры при помощи команды set, например, следующие команды интерактивного режима:
возвращают результат, аналогичный команде
Конечно, при поиске записей для одного имени использовать интерактивный режим бессмысленно. Но при необходимости работы с большим количеством записей он очень удобен, так как позволяет работать в режиме диалога.
Заключение
Мы рассмотрели основы работы с командой nslookup, а также основные типы записей DNS. Для более подробной информации о команде и ее опциях можно обратиться к соответствующей man-странице.
Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.
Команда nslookup в Windows
Первым шагом является запуск командной строки в Windows. Для этого нажмите на клавишу «Win+R» на клавиатуре, введите «cmd» и нажмите «Enter«. Это откроет командную строку.
Введите команду «nslookup»
После того, как вы запустили командную строку, введите команду «nslookup» и нажмите «Enter«. Это запустит утилиту nslookup.
Введите доменное имя
Nslookup имеет несколько дополнительных опций, которые могут быть полезны в различных ситуациях. Вот несколько наиболее часто используемых опций:
- «set type» — позволяет установить тип записи DNS, который вы ищете (например, A, MX, NS и т.д.).
- «set debug» — включает отладочный режим и отображает больше информации о запросе DNS.
- «set query» — устанавливает формат вывода для результатов поиска.
Чтобы использовать эти опции, просто введите «set» и название опции, а затем значение опции.
Примеры использования команды nslookup в Windows
Здесь мы покажем примеры, как использовать команду nslookup в Windows.
Определение IP-адреса домена
Выполните команду «nslookup google.com«. Вы увидите ответ, который должен выглядеть примерно так:
Проверка наличия записи MX
Для выполнения этого примера выполните команду «nslookup -type=mx google.com«. Вы увидите ответ, который должен выглядеть примерно так:
Пример 2 Проверка наличия записи MX c помощью nslookup
В ответе отображаются записи MX, которые указывают, какие серверы обрабатывают электронную почту для домена Google.
Проверка наличия записи NS
Для выполнения этого примера выполните команду «nslookup -type=ns google.com«. Вы увидите ответ, который должен выглядеть примерно так:
Пример 3 Проверка наличия записи NS c помощью nslookup
В ответе отображаются записи NS, которые указывают, какие серверы имен обрабатывают запросы для домена Google.
Проверка наличия записи TXT
Для выполнения этого примера выполните команду «nslookup -type=txt google.com«. Вы увидите ответ, который должен выглядеть примерно так:
Пример 4 Проверка наличия записи TXT c помощью nslookup
В ответе отображаются записи TXT, которые могут содержать информацию о домене, например, информацию о политике отправки почты.
Проверка связанности DNS
Для выполнения этого примера выполните команду «nslookup -debug google.com«. Вы увидите ответ, который должен выглядеть примерно так:
Пример 5 Проверка связанности DNS c помощью nslookup
В заключение, команда nslookup является полезным инструментом для проверки связанности DNS и различных типов DNS-записей. Путем использования различных опций и параметров вы можете получить информацию о серверах имен, ответственных за обработку запросов для доменов, а также о других записях DNS, таких как записи MX, NS, TXT и CNAME. Если вы работаете сетевым администратором или занимаетесь настройкой сетевых соединений, то команда nslookup может быть необходимым инструментом в вашем арсенале.
Утилита и одноименная команда nslookup позволяет обращаться к серверу имен (NS) из командной строки. С ее помощью можно выполнить проверку работы DNS-сервера и созданных в нем записей. В данной инструкции подробно разберем работу с данной утилитой.
nslookup и синтаксис
Описание опций
Примеры
Аналоги
Ввод команды и синтаксис
Для работы с утилитой необходимо открыть командную строку (cmd или powershell в Windows и unix-shell в UNIX). В системах на базе Windows утилита встроена, и мы можем работать с ней в любой момент. Для некоторых дистрибутивов Linux потребуется установка утилиты одной из команд:
yum install nslookup
apt-get install nslookup
* первая команда для систем на базе Red Hat, вторая — Debian.
Для выполнения запросов используем команду:
Самый простой пример использования команды:
Утилита также поддерживает работу в интерактивном режиме — вводим команду:
После можно делать запросы.
Опции nslookup
При выполнении запросов мы можем использовать следующие опции:
Также мы можем вызвать описание для nslookup.
а) в системах на базе Windows:
б) в Linux:
Использование опций
При вводе команды nslookup к опциям добавляем дефис, например:
nslookup -timeout=1 -type=MX dmosk.ru
Если мы работаем с nslookup в интерактивном режиме, то опции задаются с помощью команды set:
* первая команда задает опцию для выполнения подробных запросов. Вторая — делает запрос для домена dmosk.ru.
1. Запрос записи ipv6 для домена mail.ru.
nslookup -type=AAAA mail.ru
б) интерактивный режим:
2. Узнать NS серверы для домена google.com.
3. Определить mx-записи для yandex.ru через DNS-сервер 8.8.8.8
nslookup -type=MX yandex.ru 8.8.8.8
Аналоги nslookup
1) В качестве альтернативы командной строке, можно воспользоваться различными онлайн сервисами для выполнения запросов к DNS. Например, на 2whois.ru.
2) Для Linux можно воспользоваться утилитой dig, которая также предназначена для выполнения запросов к DNS.
3) На мобильных устройствах, например, под управлением Android есть свои утилиты для опроса DNS. Например, Ping & Net.
Была ли полезна вам эта инструкция?
In this tutorial, you will learn how to use nslookup to check DNS records.
I’ll show you how to check several DNS record types (A, PTR, CNAME, MX, etc) by using the windows nslookup command.
And in this post, I’ll show you how to use nslookup against your local DNS server and an external DNS server (great tip for troubleshooting).
Let’s get started!
Table of Contents:
How DNS works
Understanding how DNS works will help you troubleshoot DNS issues faster. It will help you identify if it’s a client, a local DNS issue, or another DNS server (forwarding server or ISP).
Computer and other network devices communicate by IP address. It would be hard to remember the IP address of every website or resource you access, domain names are easier to remember. DNS will take the easy to remember name and map it to the IP address so devices can communicate.
Below I walk through how a computer uses DNS to resolve names.
- The DNS server that the client uses may not know the IP address. This can be your local Active Directory DNS server or your ISP DNS server. If it doesn’t know the IP address of the domain it will forward it on to the next DNS server.
- The next DNS server says it knows the IP address and sends the request back to the computer.
- The computer is then able to communicate to google.com.
DNS uses resource records to provide details about systems on a network. The above example used an A resource record which maps a domain name to an IP address.
In the examples below I will show you how to query different resource records.
Why you must learn the Nslookup command line tool
When DNS is not working devices cannot communicate. You will be unable to browse websites, send an email, chat online, stream videos, and so on.
If you have a local DNS server issue then your employees can’t work and business is impacted.
You need a way to quickly troubleshoot and resolve these issues.
That is why it’s important to know how to use the Nslookup command.
This command is built into all Windows operating systems, it’s free and easy to use.
NSLookup Syntax
To view the syntax just type nslookup hit enter then type?
Here is a screenshot
There are a lot of options but in most cases, you will only need a few of them to verify DNS records. The most useful command switches are set type, server, and debug. I’ll show you the most commonly used commands below.
How to Use Nslookup to Check DNS Records
Below are several examples of how to use nslookup to check various DNS record types. By default, nslookup will use the local DNS server configured by your computer. See the last example to change Nslookup to use an external server.
Nslookup IP Address (IP to Domain Name)
Use this command if you know the IP address and want to find the domain name. In the screenshot below the IP 8.8.8.8 resolves to the domain name dns.google.com
Nslookup domain name (Domain to IP Address)
If you want to find the IP address of a domain name then use this command. In this example, the domain name ad.activedirectorypro.com resolves to several IP addresses.
Nslookup MX record
nslookup -type=mx domainname
Nslookup SOA Record
nslookup -type=soa ad.activedirectorypro.com
The Start of Authority record indicates which DNS server is the best source of information for the domain. This will return the primary name server, responsible mail addresses, default ttl, and more.
Nslookup CNAME
nslookup -type=cname www.activedirectorypro.com
The CNAME record is used to alias or redirects one DNS name to another DNS name.
Nameserver lookup
nslookup -type=na ad.activedirectorypro.com
Use the above command to view the name servers for a domain. You can see below the name servers for my domain are dc1, dc2 and dc3.
Nslookup TXT record
nslookup -type=na domainname
Use this command to view text DNS records for a domain.
Nslookup all DNS records
nslookup -type=any ad.activedirectorypro.com
This command will display all available records.
Nslookup domain controller
Use these steps to list all domain controllers for a specific domain.
- From the command prompt type nslookup and press enter
- Then type set type=SRV and press enter
- Next, type _ldap._tcp.ad.activedirectorypro.com and press enter. (replace ad.activedirectorypro.com with your domain name).
This will display all domain controllers for the ad.activedirectorypro.com domain.
Nslookup Verbose
Turning on debug will display a lot more details about the resource record such as primary name server, mail address, default TTL, and much more. To turn on debug use the command below
nslookup
set debug
Nslookup use External DNS server
This is very useful in troubleshooting. Maybe a website isn’t loading on your internal network but does when you are off the network. You can use this to see if your internal DNS is returning different results than an external DNS server. You can use your ISP DNS server or google.
To change the DNS server type nslookup and press “enter”.
Then type server IPADDRESS. For example “server 8.8.8.8” and press enter. This will instruct the nslookup command to use the 8.8.8.8 server to run DNS record lookups.
Tips for troubleshooting DNS Problems
Here are my tips for troubleshooting DNS issues.
Step#1 Make sure you have connectivity to the DNS server?
If your client has communication issues with the DNS server then name resolution is not going to work.
To check what DNS is set on a Windows system use this command:
Now take the IP listed for the DNS server and see if the client can ping it or communicate with it.
Step #2 Are other users or devices having name resolution issues?
You need to determine how big of a problem you have. Is it just one, two, or many devices that have name resolution issues?
If it’s just one then you may just have a client issue. If it’s all or many then you may have an issue with the local or upstream DNS server.
Step #3 Use NSLookup to test local server
Use NSLookup to verify the local DNS server is working correctly. Use the command to verify DNS records on local servers. If you need examples see the previous section.
If you are having issues internally you will want to check the health of your Active Directory environment. Since DNS and AD are very tightly integrated a faulty domain controller could be causing your DNS issues. See my tutorial on how to check domain controller health.
Step #5 Use NSlookup server to test forwarding DNS Server (UPstream)
Viruses and spyware can install all kinds of nasty things on computers to redirect traffic to malicious sites. Browser hijacking is very common
Step #7 Check the client’s host file
I don’t recommend adding entries to the host file but if it contains incorrect or outdated data, you won’t be able to connect. Viruses can also modify the host file which would redirect you to malicious websites.
Step #8 Flush DNS Cache
The client’s cache could be the problem to flush the cache run this command
I hope this article helped you understand the NSLookup and how it can be used to verify and troubleshoot DNS. If you liked this video or have questions leave a quick comment below.
Summary
In this guide, I walked through several examples of how to use the nslookup windows command. The nslookup command is a great tool to troubleshoot and check DNS records. A lot of times network issues are related to DNS and knowing how to quickly verify DNS is working correctly can be a huge time saver.
Привет, мир! Рассказываем про 10 самых часто используемых команд nslookup.
Что такое nslookup?
Определение NS-записей домена
nslookup –type=ns merionet.ru
Определение SOA записи узла
SOA-запись (Start of Authority) — начальная запись зоны, которая указывает местоположение эталонной записи о домене. Она содержит в себе контактную информацию лица, ответственного за данную зону, время кэширования информации на серверах и данные о взаимодействии DNS. SOA-запись создается автоматически. Для определения SOA записи используется команда:
nslookup –type=SOA merionet.ru
Как найти MX-запись хоста
Электронная почта сегодня используется повсеместно. Чтобы отправлять и получать электронные письма хост используется тип записи MX. В каждой MX-записи хранятся два поля:
- имя почтового сервера, который обслуживает домен
- порядковый номер, по которому определяется какой сервер первым будет обрабатывать запросы клиентов
Для определения MX-записей хоста используется команда:
nslookup –type=MX merionet.ru
Определение всех типов DNS-записей
nslookup –type=any merionet.ru
Явное указание DNS-сервера
nslookup merionet.ru dns2.yandex.ru
Как видно из скриншота, ответ нам вернул уже сервер Яндекса.
Обратный DNS lookup
Изменение номера порта для запроса
По умолчанию, для запросов DNS использует 53 (UDP) порт. Но это поведение тоже можно изменить, хотя особого необходимости в этом нет.
nslookup –port=56 merionet.ru
Бывают случаи, особенно при слабых Интернет соединениях, что ответа от сервера приходится ждать долго. По умолчанию, если ответ не приходит в течении 5 секунд, то запрос повторяется, увеличив время ожидания в два раза. Но можно вручную задать это значение в секундах:
nslookup –timeout=10 merionet.ru
Отработку этой команды увидеть сложно, но она может быть эффективна при соединениях с низкой скоростью.
Включение режима отладки
Режим отладки позволяет получать более детальную информацию об узле. Для этого используется команда:
nslookup –debug merionet.ru
Когда утилита nslookup возвращает ответ, там указывается с какого сервера вернулся ответ. Эти сервера бывают authoritative и non-authoritative answer.
Authoritative answer – это ответ, полученные непосредственно от сервера, который располагает информацией об указанном домене. В нашем случае – это dns2.yandex.ru. Non-authoritative answer – это ответ, полученный от промежуточного сервера. В нашем случае – это мой роутер.
Рекомендуем
DNS is a tiered distributed name mechanism for systems, facilities, or any commodity linked to the net or an isolated network. It includes diverse pieces of data to domain names allocated to every one of the participants. Most notably, it converts domain names that are important to people into the numeric IP addresses required to update computer devices and applications throughout the globe.
The Domain Name System is indeed an important part of the Web’s operation since it provides a globally distributed keyword-based redirecting facility. NSLOOKUP is a command-line utility included with Microsoft Windows. In this guide, we will learn about the DNS lookup in the windows system. So, let’s get started.
Between these DNS settings, we have an entry of www.google.com and its information as shown in the below image. Remember the given data of Google provided in the image.
These settings have also a record about www.youtube.com and its information as presented below. Make sure to remember the provided information on Youtube as well.
As we have a lot of DNS settings in our system, let’s just quickly delete all of them at once. For this reason, use the ipconfig command with the keyword “flushdns” along with the backslash sign and tap the Enter button. You will see that it will flush all the previous entries from the cache as the success message is presenting in the image below.
Check the DNS settings once again using the previous displaydns command as below. You can see, this time it displays nothing because all the entries are flushed out.
Let’s ping the Youtube address using the below query of ping and hit the Enter key from the keyboard.
Now, let’s have a look at the DNS settings once again by utilizing the displaydns command in the command prompt as below and tap Enter. You can see it shows the Google and Youtube entries in the settings while all the other settings are flushed out. You will see that the settings of Google mentioned below are different from the information provided before the flush of DNS.
The IP address, as well as other details, must be included in DNS data for www.youtube.com and www.google.com. A TTL value typically differs from TTL inside an IP packet, which seems to be another entry inside the DNS buffer. The DNS server that manages the Youtube and Google record sends this DNS TTL value. It is calculated in seconds and also instructs the DNS client about how long to buffer the DNS data to avoid clients lingering on to DNS information which IP addresses ought to update.
Youtube entry is as below. The information regarding Youtube given below is very different from the previous information before the flush action taken place.
Navigate towards the C:\WindowsSystem32Driversetc. Select the option of “All Files” from the dialogue box to see all the files residing in the “Etc” folder. You will get a list of some files. Double-click on the “hosts” file to open it in a notepad.
Now, the “hosts” file has been opened in the notepad as presented below with some service records.
Add the below-shown IP address with a name at the bottom of the notepad file. Save your file and quit it quickly.
Let’s check the DNS settings once again to look up the new entry in the host file using the ipconfig command of displaydns, and tap on Enter. The output image is showing the new entry “university” in the cache.
Ping the new entry with our server using the below query and tap Enter.
Add the below path of a site with the “nslookup” keyword in the command prompt. The title and Source IP of the DNS server, as well as the identity and IP of www.ulster.ac.uk, are shown. You can search for a host’s IP without even connecting with it by using Nslookup.
Let’s use the nslookup command in the command prompt and tap Enter. We would then be in the interactive environment of Nslookup. An arrowhead prompting should appear.
Enter the below site path in the interactive mode and hit the Enter button. You can see it returns many IP addresses.
Retype the same site path and press Enter. This time it returns the different IP addresses for the same site with a different pattern. This implies we can access the site www.google.com by using many different IP addresses.
You can use the below command to check how many of the “A” records are there in your DNS.
If you want to check how many of the “ns” records are there in your DNS system, then try out the below query in the command prompt. The output shows a 1 “ns” record.
nslookup –=ns example
nslookup –=soa example
If we want to check the mail servers’ “MX” records in our DNS system, we can do so by utilizing the below query.
nslookup –=mx example
Conclusion
In this guide article, we have performed every step to do DNS lookup in Windows 10 system. All the instructions are perfectly functional on all previous versions of Windows.
I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.