Как проверить DNS-запись через dig и правильно прочитать ответ
Как читать DNS-ответ dig: реальные примеры NOERROR с адресами, пустого ответа NODATA и NXDOMAIN. Статус, TTL и следующий шаг проверки без изменения сети.

В этой статье
После переноса сайта один компьютер открывает новую версию, а другой — старую. Причина может быть в DNS, но сначала нужно получить проверяемый ответ: какое имя запрашивается, какой тип записи нужен и какой сервер вернул результат. Короткое «домен не работает» для диагностики слишком неопределённо.
Задайте имя явно
Пример рассчитан на установленную утилиту dig из BIND. Введите полное доменное имя после следующей команды, без протокола и пути страницы:
read -r TARGET_HOST
dig "$TARGET_HOST" A
Запрос проверяет записи IPv4. Для IPv6 выполните отдельную проверку:
dig "$TARGET_HOST" AAAA
Имя основной страницы и имя с дополнительным поддоменом могут иметь разные записи. Не переносите вывод одной проверки на все адреса сайта.
Смотрите не только на адрес
В полном ответе важны статус, секция ответа, TTL и сервер, к которому обращалась утилита. Статус отсутствующего имени отличается от успешного ответа без записей запрошенного типа. Например, отсутствие IPv6-записи не означает, что у имени нет IPv4-адреса.
Ошибка обработки запроса тоже не равна отсутствию домена. Она может быть связана с обслуживанием зоны, проверкой DNSSEC или недоступностью зависимости. Для правильного вывода сохраняйте полный статус, а не только пустую строку из сокращённого режима.
Три реальных ответа: адрес, пустой ответ и отсутствующее имя
2 октября 2026 года в 15:48 МСК мы выполнили три публичных запроса из macOS с DiG 9.10.6 к DNS-серверу 1.1.1.1. Это демонстрация чтения ответа, а не тест DNS вашего сайта. Адреса, TTL, идентификаторы и время запроса ниже относятся к этому наблюдению и при повторе могут отличаться.
dig @1.1.1.1 example.com. A +time=2 +tries=1 +noall +comments +answer +authority +stats
Фрагмент ответа на запрос A:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7430
example.com. 291 IN A 172.66.147.243
example.com. 291 IN A 104.20.23.154
;; SERVER: 1.1.1.1#53(1.1.1.1)
Обе строки относятся к имени example.com., классу IN и типу A. Число 291 — TTL в секундах в полученном ответе; это не время отклика сайта. Два адреса не означают ошибку: у одного имени может быть несколько A-записей.
dig @1.1.1.1 example.com. CNAME +time=2 +tries=1 +noall +comments +answer +authority +stats
У того же имени запрос CNAME вернул NOERROR, но без записей запрошенного типа. Фрагмент полного ответа:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60948
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
В секции AUTHORITY была запись SOA. Сочетание статуса, отсутствия подходящих ответов и SOA позволило распознать NODATA: для запрошенного типа данных нет. Одного ANSWER: 0 недостаточно — такой ответ нужно отличить от перенаправления к другим DNS-серверам. Наличие A-записей у этого же имени уже подтверждено предыдущим запросом.
dig @1.1.1.1 seo-diagnostic.invalid. A +time=2 +tries=1 +noall +comments +answer +authority +stats
Третий запрос к заведомо недействительному имени вернул:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 54998
Все три вызова dig завершились с кодом 0, включая NXDOMAIN. Код процесса подтверждает получение DNS-ответа в этих вызовах; вывод «имя существует и нужная запись найдена» нужно делать по статусу и секциям, а не по одному $? или пустому +short.
Наблюдение | Что показал ответ | Следующая проверка |
|---|---|---|
NOERROR и подходящие A/AAAA в ANSWER | Сервер вернул адреса для заданного имени и типа. | Если сайт не открывается, проверить соединение, TLS и веб-ответ. |
NOERROR, нет нужного типа, SOA в AUTHORITY | В показанном ответе нет данных нужного типа (NODATA). | Сверить запрошенный тип и авторитетные данные зоны; проверить другие необходимые типы. |
NXDOMAIN | Запрашиваемое имя либо конечная цель цепочки CNAME не существует по полученному ответу. | Сверить точное имя и цель алиаса, затем нужный сервер зоны. |
Различие NXDOMAIN и NODATA, включая обработку CNAME, описано в RFC 2308.
Имя в зоне .invalid выбрано как заведомо недействительное по RFC 2606.
Параметры запроса и секции вывода описаны в руководстве BIND по dig.
Если dig возвращает ожидаемый адрес, а приложение использует другой, следующая задача — сравнить путь разрешения имени через resolvectl.
Если имя разрешается, но соединение не устанавливается, начните с просмотра выбранного IP-маршрута.
Компактный вариант для уже понятной ситуации
Когда контекст известен, ответ можно сократить, оставив комментарии и записи:
dig "$TARGET_HOST" A +noall +answer +comments
Этот вариант удобен для сравнения, но не заменяет полную диагностику при неизвестной ошибке. Если нужно проверить другой DNS-сервер, используйте его только при наличии понятной причины и разрешённого доступа. Публичный и корпоративный резолверы могут видеть разные DNS-данные. Для внутренней корпоративной зоны используйте разрешённый резолвер организации: ответ публичного сервера не заменяет проверку внутри корпоративной сети.
Как интерпретировать TTL
TTL связан со временем кэширования ответа. Уменьшение значения в зоне не стирает мгновенно ранее сохранённые ответы во всех кэшах. Поэтому при переносе нужно учитывать настройки до изменения, а не обещать всем пользователям одновременное переключение в заданную секунду.
Пример: два резолвера возвращают разные адреса после изменения записи. Запишите их ответы, время и TTL, затем сравните с авторитетными данными зоны. Различие может быть связано с кэшированием, но также с разными настройками или географическими ответами. Без этих деталей нельзя уверенно назвать причину.
DNS не проверяет сам сайт
Даже правильный адрес не подтверждает, что веб-сервер принимает соединения и отдаёт нужный виртуальный хост. После DNS отдельно проверяют соединение, сертификат и ответ приложения. И наоборот: открытая по IP страница не доказывает правильность DNS и маршрутизации доменного имени.
Для передачи в поддержку сохраните имя, тип записи, статус, адрес резолвера и время проверки. После изменения повторите запрос в той же среде. Такой набор данных помогает отделить ошибку зоны от кэша и от проблемы, которая вообще находится за пределами DNS.
Сравнивая ответы, сохраняйте регистр представления отдельно от смысла имени и обращайте внимание на цепочку псевдонимов. Итоговый адрес может относиться к цели CNAME, а не быть непосредственной записью исходного имени.
After migrating a site, one computer opens the new version while another opens the old one. The cause may be DNS, but first you must obtain a verifiable response: which name is being queried, which record type is needed, and which server returned the result. A brief "domain not working" is too vague for diagnostics.
Specify the name explicitly
The example assumes the dig utility from BIND is installed. Enter the full domain name after the following command, without the protocol or page path:
read -r TARGET_HOST
dig "$TARGET_HOST" A
The query checks IPv4 records. For IPv6, perform a separate check:
dig "$TARGET_HOST" AAAA
The main page name and the name with an additional subdomain may have different records. Do not transfer the output of one check to all site addresses.
Look beyond just the address
In a full response, the status, answer section, TTL, and the server the utility contacted are important. The status for a non-existent name differs from a successful response with no records of the requested type. For example, the absence of an IPv6 record does not mean the name lacks an IPv4 address.
A request processing error is also not equivalent to a non-existent domain. It may be related to zone maintenance, DNSSEC validation, or the unavailability of a dependency. To draw correct conclusions, preserve the full status rather than just an empty string from the shortened mode.
Three real responses: an address, an empty response, and a non-existent name
On October 2, 2026, at 15:48 MSK, we performed three public queries from macOS using DiG 9.10.6 against the DNS server 1.1.1.1. This demonstrates how to read the response, not a test of your site's DNS. The addresses, TTLs, identifiers, and query times below relate to this observation and may differ upon repetition.
dig @1.1.1.1 example.com. A +time=2 +tries=1 +noall +comments +answer +authority +stats
Fragment of the response to an A query:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7430
example.com. 291 IN A 172.66.147.243
example.com. 291 IN A 104.20.23.154
;; SERVER: 1.1.1.1#53(1.1.1.1)
Both lines refer to the name example.com., class IN, and type A. The number 291 is the TTL in seconds in the received response; this is not the site's response time. Two addresses do not indicate an error: a single name can have multiple A records.
dig @1.1.1.1 example.com. CNAME +time=2 +tries=1 +noall +comments +answer +authority +stats
The same name queried for a CNAME returned NOERROR, but without records of the requested type. Fragment of the full response:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60948
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
The AUTHORITY section contained an SOA record. The combination of status, the absence of matching answers, and the SOA record allowed recognition of NODATA: there are no records of the requested type. An ANSWER count of 0 is insufficient; such a response must be distinguished from a referral to other DNS servers. The presence of A records for this same name was already confirmed by the previous query.
dig @1.1.1.1 seo-diagnostic.invalid. A +time=2 +tries=1 +noall +comments +answer +authority +stats
The third query to a known invalid name returned:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 54998
All three dig calls completed with exit code 0, including NXDOMAIN. The process code confirms that a DNS response was received in these calls; the output 'name exists and the required record was found' must be determined by status and sections, not by a single $? or an empty +short output.
Observation | What the response showed | Next check |
|---|---|---|
NOERROR and matching A/AAAA in ANSWER | The server returned addresses for the specified name and type. | If the site does not open, check the connection, TLS, and web response. |
NOERROR, no matching type, SOA in AUTHORITY | The response shown contains no data of the required type (NODATA). | Verify the requested type and the zone's authoritative data; check other necessary types. |
NXDOMAIN | The requested name or the final target of the CNAME chain does not exist according to the received response. | Verify the exact name and alias target, then the appropriate zone server. |
The distinction between NXDOMAIN and NODATA, including CNAME handling, is described in RFC 2308.
The name in the .invalid zone is chosen as inherently invalid per RFC 2606.
Query parameters and output sections are described in the BIND dig manual.
If dig returns the expected address but the application uses a different one, the next step is to compare the name resolution path via resolvectl.
If the name resolves but the connection fails, start by checking the selected IP route.
Compact option for an already clear situation
When the context is known, the response can be shortened, leaving only comments and records:
dig "$TARGET_HOST" A +noall +answer +comments
This option is convenient for comparison but does not replace full diagnostics for an unknown error. If you need to check another DNS server, use it only with a clear reason and authorized access. Public and corporate resolvers may return different DNS data. For an internal corporate zone, use the organization's authorized resolver: the response from a public server does not replace verification within the corporate network.
How to interpret TTL
TTL is tied to the response caching time. Reducing the value in the zone does not instantly erase previously cached responses in all caches. Therefore, when migrating, you must consider settings before the change, not promise all users an immediate switch at a specific second.
Example: two resolvers return different addresses after a record change. Record their responses, time, and TTL, then compare them with the zone's authoritative data. The difference may be due to caching, but also to different settings or geographic responses. Without these details, you cannot confidently identify the cause.
DNS does not verify the website itself
Even a correct address does not confirm that the web server accepts connections and serves the intended virtual host. After DNS resolution, the connection, certificate, and application response must be checked separately. Conversely, a page accessible via IP does not prove correct DNS or domain name routing.
To submit to support, save the name, record type, status, resolver address, and check time. After making changes, repeat the query in the same environment. This data set helps distinguish zone errors from cache issues and problems occurring entirely outside DNS.
When comparing responses, preserve the case of the presentation separately from the meaning of the name and pay attention to the alias chain. The final address may refer to the CNAME target rather than being a direct record of the original name.





Обсуждение 0
Делись опытом и задавай вопросы. Комментарии без ссылок появляются после проверки редактором.
Пока никто не написал. Начни обсуждение.