Nslookup command in windows

Команда NSLOOKUP — работа с сервером DNS из командной строки

&nbsp &nbsp Утилита NSLOOKUP присутствует в операционных системах Windows, начиная с Windows NT , и предназначена для формирования запросов к серверам DNS из командной строки. Фактически, утилита является аналогом службы DNS-клиент и позволяет диагностировать проблемы с разрешением имен в системе DNS. По умолчанию, все запросы отправляются на DNS-сервер, адрес которого задан настройками сетевого подключения. В терминах утилиты такой сервер является сервером по умолчанию (default server). Команда ipconfig /all позволяет получить информацию о настройках протокола IP и, в том числе, о серверах DNS, используемых в системе.

При запуске nslookup без параметров, утилита переходит в интерактивный режим, ожидая ввод команд пользователя. Ввод знака вопроса или help позволяет отобразить справку о внутренних командах и опциях nslookup :

(идентификаторы отображаются в верхнем регистре, квадратные скобки «[]» обозначают необязательные параметры)

NAME — печать сведений об узле или домене NAME с помощью сервера по умолчанию
NAME1 NAME2 — та же операция, но в качестве сервера используется NAME2
help или ? — печать сведений о стандартных командах
set OPTION — установить параметр
all — печать параметров, текущего сервера и узла
[no]debug — печать отладочных сведений
[no]d2 — печать полных отладочных сведений
[no]defname — добавить имя домена ко всем запросам
[no]recurse — запрос рекурсивного ответа на запрос
[no]search — использовать список поиска доменов
[no]vc — всегда использовать виртуальную схему
domain=NAME — установить имя домена по умолчанию NAME
srchlist=N1[/N2/. /N6] — установить домен N1 и список поиска N1,N2 и т.д.
root=NAME — установить корневой сервер NAME
retry=X — установить число повторов X
timeout=X — установить интервал времени ожидания в X секунд
type=X — установить тип запроса (пр. A,AAAA,A+AAAA,ANY,CNAME,MX ,NS,PTR,SOA,SRV)
querytype=X — то же, что и type
class=X — установить класс запроса ( IN (Internet), ANY)
[no]msxfr — использовать быструю зону MS для передачи
ixfrver=X — текущая версия, использующаяся в передаче запросов IXFR
server NAME — установить сервер по умолчанию NAME, используя текущий сервер по умолчанию
lserver NAME — установить сервер по умолчанию NAME, используя первоначальный сервер
root — сделать текущий сервер по умолчанию корневым сервером
ls [opt] DOMAIN [> FILE] — перечисление адресов в домене DOMAIN (необязательно: вывод в файл FILE)
-a — перечисление канонических имен и псевдонимов
-d — перечисление всех записей
-t TYPE — перечисление записей указанного типа RFC (пр. A,CNAME,MX,NS,PTR etc.)
view FILE — сортировка файла «ls» и его просмотр с помощью pg

exit — выход из программы

Примеры использования команды NSLOOKUP

При запуске с некоторыми из выше перечисленных параметров, команда nslookup выполняется в не интерактивном режиме без диалога с пользователем:

nslookup yandex.ru. — выполнить запрос к DNS-серверу, заданному по умолчанию, на разрешение доменного имени yandex.ru . Для уменьшения количества ненужных запросов к серверам имен, имя домена нужно вводить в виде полностью определенного имени (fully qualified domain name) , т.е. с точкой в конце. Если этого не делать, то nslookup будет сначала выполнять запрос на разрешение имени относительно домена того компьютера, на котором она выполняется, т.е. yandex.ru.mydomain.ru если имя локального домена — mydomain.ru.

nslookup -type=mx yandex.ru — то же, что и в предыдущем примере, но с указанием типа запрашиваемой записи -type=mx . Сервер DNS ответит на запрос утилиты nslookup перечислением почтовых серверов, обслуживающих домен yandex.ru

nslookup odnoklassniki.ru 8.8.8.8 — определить IP-адрес узла odnokassniki.ru с использованием DNS-сервера 8.8.8.8 (публичный DNS-сервер Google), вместо DNS-сервера, заданного в настройках сетевого подключения.

Читайте также:  Диск работает неправильно windows

nslookup -type=mx -timeout=8 vk.com 208.67.220.220 — отобразить запись MX для домена vk.com из базы данных сервера с IP-адресом 208.67.220.220 (сервер OpenDNS). При выполнении команды, максимальное время ожидания ответа сервера — 8 секунд.

nslookup -type=any -timeout=8 vk.com 208.67.220.220 — то же, что и в предыдущем примере, но выполняется запрос на отображение любых типов записей.

Пример отображаемых данных:

Сервер: 208.67.220.220
Не заслуживающий доверия ответ:
vk.com internet address = 87.240.131.119
vk.com internet address = 87.240.131.99
vk.com nameserver = ns2.vkontakte.ru
vk.com nameserver = ns4.vkontakte.ru
vk.com nameserver = ns1.vkontakte.ru
vk.com nameserver = ns4.vkontakte.ru
vk.com nameserver = ns2.vkontakte.ru
vk.com nameserver = ns1.vkontakte.ru
ns1.vkontakte.ru internet address = 93.186.237.2
ns2.vkontakte.ru internet address = 93.186.224.100

Для разных версий nslookup и разных DNS-серверов, обслуживающих запрос, отображаемая информация может незначительно отличаться. Тот же запрос, сформированный англоязычной версией утилиты nslookup.exe и направленный на обработку DNS-серверу компании Google приведет к отображению следующих данных:

Non-authoritative answer:
vk.com internet address = 87.240.131.120
vk.com internet address = 87.240.143.244
vk.com

primary name server = ns1.vkontakte.ru
responsible mail addr = ncc.vkontakte.ru
serial = 2013100501
refresh = 3600 (1 hour)
retry = 900 (15 mins)
expire = 604800 (7 days)
default TTL = 900 (15 mins)
vk.com AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:901
vk.com AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:902
vk.com AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:903
vk.com nameserver = ns1.vkontakte.ru
vk.com nameserver = ns2.vkontakte.ru
vk.com nameserver = ns4.vkontakte.ru
vk.com MX preference = 10, mail exchanger = mail.vk.com
vk.com text =»v=spf1 ip4:93.186.224.0/20 ip4:87.240.128.0/18 mx include:aspmx.googlemail.com

Сообщение «Не заслуживающий доверия ответ:» (Non-authoritative answer: ) говорит о том, что выполняющий запрос DNS-сервер, не является владельцем зоны vk.com т.е. записи для узла vk.com в его базе отсутствуют, и для разрешения имени использовался рекурсивный запрос к другому DNS-серверу. Если отправить запрос DNS-серверу ns1.vkontakte.ru, то будет получен авторитетный ответ (authoritative answer) :

Server: ns1.vkontakte.ru
Address: 93.186.237.2

primary name server = ns1.vkontakte.ru
responsible mail addr = ncc.vkontakte.ru
serial = 2013100501
refresh = 3600 (1 hour)
retry = 900 (15 mins)
expire = 604800 (7 days)
default TTL = 900 (15 mins)
vk.com internet address = 87.240.131.118
vk.com AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:904
vk.com AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:905
vk.com AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:906
vk.com nameserver = ns4.vkontakte.ru
vk.com nameserver = ns1.vkontakte.ru
vk.com nameserver = ns2.vkontakte.ru
vk.com MX preference = 10, mail exchanger = mail.vk.com
vk.com text = «v=spf1 ip4:93.186.224.0/20 ip4:87.240.128.0/18 mx include:aspmx.googlemail.com

all»
ns4.vkontakte.ru internet address = 93.186.239.253
ns4.vkontakte.ru AAAA IPv6 address = 2a00:bdc0:ff:4::2
ns1.vkontakte.ru internet address = 93.186.237.2
ns1.vkontakte.ru AAAA IPv6 address = 2a00:bdc0:ff:1::2
ns2.vkontakte.ru internet address = 93.186.224.100
ns2.vkontakte.ru AAAA IPv6 address = 2a00:bdc0:ff:2::2
mail.vk.com internet address = 93.186.236.94

Использование опции отладки (debug) позволяет получить дополнительную информацию, содержащуюся в заголовках запросов клиента и ответов сервера (время жизни, флажки, типы записей и т.п.): > server ns1.vkontakte.ru
————

Got answer:
HEADER:

opcode = QUERY, rcode = NXDOMAIN
header flags: response, want recursion, recursion avail.
questions = 1, answers = 0, authority records = 1, additional = 0

ns1.vkontakte.ru, type = A, >
AUTHORITY RECORDS:

-> (root)
ttl = 440 (7 mins 20 secs)
primary name server = a.root-servers.net
responsible mail addr = nstld.verisign-grs.com
serial = 2013101600
refresh = 1800 (30 mins)
retry = 900 (15 mins)
expire = 604800 (7 days)
default TTL = 86400 (1 day)

opcode = QUERY, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 0, additional = 0

ns1.vkontakte.ru, type = A, >
ANSWERS:

-> ns1.vkontakte.ru
internet address = 93.186.237.2
ttl = 6350 (1 hour 45 mins 50 secs)

————
Default Server: ns1.vkontakte.ru
Address: 93.186.237.2

> vk.com
Server: ns1.vkontakte.ru
Address: 93.186.237.2

opcode = QUERY, rcode = REFUSED
header flags: response, want recursion
questions = 1, answers = 0, authority records = 0, additional = 0

opcode = QUERY, rcode = NOERROR
header flags: response, auth. answer, want recursion
questions = 1, answers = 11, authority records = 0, additional = 7

Читайте также:  Sftp mac os brew

vk.com, type = ANY, >
ANSWERS:

-> vk.com
ttl = 900 (15 mins)
primary name server = ns1.vkontakte.ru
responsible mail addr = ncc.vkontakte.ru
serial = 2013100501
refresh = 3600 (1 hour)
retry = 900 (15 mins)
expire = 604800 (7 days)
default TTL = 900 (15 mins)
-> vk.com
internet address = 87.240.131.99
ttl = 900 (15 mins)
-> vk.com
internet address = 87.240.131.119
ttl = 900 (15 mins)
-> vk.com
AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:901
ttl = 900 (15 mins)
-> vk.com
AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:902
ttl = 900 (15 mins)
-> vk.com
AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:903
ttl = 900 (15 mins)
-> vk.com
nameserver = ns1.vkontakte.ru
ttl = 900 (15 mins)
-> vk.com
nameserver = ns2.vkontakte.ru
ttl = 900 (15 mins)
-> vk.com
nameserver = ns4.vkontakte.ru
ttl = 900 (15 mins)
-> vk.com
MX preference = 10, mail exchanger = mail.vk.com
ttl = 900 (15 mins)
-> vk.com
text = «v=spf1 ip4:93.186.224.0/20 ip4:87.240.128.0/18 mx include:aspmx.googlemail.com

all»
ttl = 900 (15 mins)
ADDITIONAL RECORDS:
-> ns1.vkontakte.ru
internet address = 93.186.237.2
ttl = 9000 (2 hours 30 mins)
-> ns1.vkontakte.ru
AAAA IPv6 address = 2a00:bdc0:ff:1::2
ttl = 9000 (2 hours 30 mins)
-> ns2.vkontakte.ru
internet address = 93.186.224.100
ttl = 9000 (2 hours 30 mins)
-> ns2.vkontakte.ru
AAAA IPv6 address = 2a00:bdc0:ff:2::2
ttl = 9000 (2 hours 30 mins)
-> ns4.vkontakte.ru
internet address = 93.186.239.253
ttl = 9000 (2 hours 30 mins)
-> ns4.vkontakte.ru
AAAA IPv6 address = 2a00:bdc0:ff:4::2
ttl = 9000 (2 hours 30 mins)
-> mail.vk.com
internet address = 93.186.236.94
ttl = 900 (15 mins)

————
vk.com
ttl = 900 (15 mins)
primary name server = ns1.vkontakte.ru
responsible mail addr = ncc.vkontakte.ru
serial = 2013100501
refresh = 3600 (1 hour)
retry = 900 (15 mins)
expire = 604800 (7 days)
default TTL = 900 (15 mins)
vk.com
internet address = 87.240.131.99
ttl = 900 (15 mins)
vk.com
internet address = 87.240.131.119
ttl = 900 (15 mins)
vk.com
AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:901
ttl = 900 (15 mins)
vk.com
AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:902
ttl = 900 (15 mins)
vk.com
AAAA IPv6 address = 2a00:bdc0:3:103:1:0:403:903
ttl = 900 (15 mins)
vk.com
nameserver = ns1.vkontakte.ru
ttl = 900 (15 mins)
vk.com
nameserver = ns2.vkontakte.ru
ttl = 900 (15 mins)
vk.com
nameserver = ns4.vkontakte.ru
ttl = 900 (15 mins)
vk.com
MX preference = 10, mail exchanger = mail.vk.com
ttl = 900 (15 mins)
vk.com
text = «v=spf1 ip4:93.186.224.0/20 ip4:87.240.128.0/18 mx include:aspmx.googlemail.com

all»
ttl = 900 (15 mins)
ns1.vkontakte.ru
internet address = 93.186.237.2
ttl = 9000 (2 hours 30 mins)
ns1.vkontakte.ru
AAAA IPv6 address = 2a00:bdc0:ff:1::2
ttl = 9000 (2 hours 30 mins)
ns2.vkontakte.ru
internet address = 93.186.224.100
ttl = 9000 (2 hours 30 mins)
ns2.vkontakte.ru
AAAA IPv6 address = 2a00:bdc0:ff:2::2
ttl = 9000 (2 hours 30 mins)
ns4.vkontakte.ru
internet address = 93.186.239.253
ttl = 9000 (2 hours 30 mins)
ns4.vkontakte.ru
AAAA IPv6 address = 2a00:bdc0:ff:4::2
ttl = 9000 (2 hours 30 mins)
mail.vk.com
internet address = 93.186.236.94
ttl = 900 (15 mins)

nslookup 8.8.4.4 — отобразить имя узла, соответствующее IP-адресу 8.8.4.4

nslookup

Applies to: Windows Server (Semi-Annual Channel), Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Displays information that you can use to diagnose Domain Name System (DNS) infrastructure. Before using this tool, you should be familiar with how DNS works. The nslookup command-line tool is available only if you have installed the TCP/IP protocol.

The nslookup command-line tool has two modes: interactive and noninteractive.

If you need to look up only a single piece of data, we recommend using the non-interactive mode. For the first parameter, type the name or IP address of the computer that you want to look up. For the second parameter, type the name or IP address of a DNS name server. If you omit the second argument, nslookup uses the default DNS name server.

Читайте также:  Где хранятся сертификаты эцп windows 10

If you need to look up more than one piece of data, you can use interactive mode. Type a hyphen (-) for the first parameter and the name or IP address of a DNS name server for the second parameter. If you omit both parameters, the tool uses the default DNS name server. While using the interactive mode, you can:

Interrupt interactive commands at any time, by pressing CTRL+B.

Exit, by typing exit.

Treat a built-in command as a computer name, by preceding it with the escape character (). An unrecognized command is interpreted as a computer name.

Syntax

Parameters

Parameter Description
nslookup exit Exits the nslookup command-line tool.
nslookup finger Connects with the finger server on the current computer.
nslookup help Displays a short summary of subcommands.
nslookup ls Lists information for a DNS domain.
nslookup lserver Changes the default server to the specified DNS domain.
nslookup root Changes the default server to the server for the root of the DNS domain name space.
nslookup server Changes the default server to the specified DNS domain.
nslookup set Changes configuration settings that affect how lookups function.
nslookup set all Prints the current values of the configuration settings.
nslookup set class Changes the query class. The class specifies the protocol group of the information.
nslookup set d2 Turns exhaustive Debugging mode on or off. All fields of every packet are printed.
nslookup set debug Turns Debugging mode on or off.
nslookup set domain Changes the default DNS domain name to the name specified.
nslookup set port Changes the default TCP/UDP DNS name server port to the value specified.
nslookup set querytype Changes the resource record type for the query.
nslookup set recurse Tells the DNS name server to query other servers if it doesn’t have the information.
nslookup set retry Sets the number of retries.
nslookup set root Changes the name of the root server used for queries.
nslookup set search Appends the DNS domain names in the DNS domain search list to the request until an answer is received. This applies when the set and the lookup request contain at least one period, but do not end with a trailing period.
nslookup set srchlist Changes the default DNS domain name and search list.
nslookup set timeout Changes the initial number of seconds to wait for a reply to a request.
nslookup set type Changes the resource record type for the query.
nslookup set vc Specifies to use or not use a virtual circuit when sending requests to the server.
nslookup view Sorts and lists the output of the previous ls subcommand or commands.

Remarks

If computerTofind is an IP address and the query is for an A or PTR resource record type, the name of the computer is returned.

If computerTofind is a name and doesn’t have a trailing period, the default DNS domain name is appended to the name. This behavior depends on the state of the following set subcommands: domain, srchlist, defname, and search.

If you type a hyphen (-) instead of computerTofind, the command prompt changes to nslookup interactive mode.

If the lookup request fails, the command-line tool provides an error message, including:

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