The nslookup (name server lookup) command line tool allows you to query the DNS server from the CLI. Nslookup is used to diagnose and check DNS servers and records, and to detect problems with name resolution. In this article, we are going to look at some basic examples of how to use the nslookup command in Windows.
How to Use the Nslookup Command in Windows
By default, the nslookup command sends DNS queries to the preferred name server specified in your network adapter settings. To find out the IP address of the preferred DNS server in Windows, use the command:
ipconfig /all
The nslookup command can be used in either interactive or non-interactive mode.
The following is an example of a non-interactive nslookup command:
Nslookup theitbros.com
In this example, we requested the IP address of theitbros.com domain. The nslookup queries the DNS server (it is specified in the Server line) and it returns that this name matches the IP Address 34.149.36.179.
The non-authoritative answer means that the DNS server that made the request is not the owner of the theitbros.com zone and that a recursive query to another DNS server has been used to perform the name resolution (by default, recursive DNS queries are enabled).
You can make a query against an authoritative name server by specifying its address directly in the parameters of the nslookup command:
Nslookup theitbros.com ns1.siteground.net
- If no records were found for the specified DNS name, the nslookup will return the error: *** can’t find theitbros.com: Non-existent domain
- If your DNS server is unavailable or not responding, you will receive a DNS request timed out error.
If you run the nslookup command without any parameters, the utility will switch to the interactive mode. Simply enter the DNS hostname to resolve a name to an IP address interactively:
You can perform reverse lookups (get DNS name by IP address). Just type the IP address in the nslookup interactive prompt and press Enter.
In the interactive mode of nslookup, a large number of additional options are available. Type a question (?) in the interactive console for a complete list of nslookup subcommands.
Tip. Note that nslookup commands are case-sensitive.
To close the interactive nslookup session, type exit and press Enter.
Using Nslookup to View Different DNS Records
By default, the nslookup command only returns DNS resource records of type A and AAAA, but you can use different types of resource records:
You can set specific record types to lookup using the command:
-type=<record_type>
The following types of DNS resource records can be used in nslookup:
- A
- ANY
- CNAME
- GID
- HINFO:
- MB
- MG
- MINF
- MR
- MX
- NS
- PTR
- SOA
- TXT
- UID
- UINFO
- WKS
For example, to find the authoritative name servers for a specific domain, set the record type to NS (Name Server):
set query=ns theitbros.com
List of all the mail servers that are configured for a specific domain (MX, Mail eXchange records):
nslookup -type=mx theitbros.com
In this example, this domain has 3 MX records with priorities 10, 20 and 30 (the lower the number, the higher the MX priority).
To list all the DNS records in the domain zone, run the command:
nslookup -type=any theitbros.com
List the TXT records of a domain (for example, when viewing SPF settings):
nslookup -type=TXT theitbros.com
The debug option allows you to get additional information contained in the headers of client DNS requests and server responses (lifetime, flags, record types, etc.):
set debug
You can list the currently enabled nslookup options:
> set all
Most Commonly Used Nslookup Commands with Examples
List authoritative name servers for the domain (NS records):
nslookup -type=ns theitbros.com
Get the SOA record for the domain (Start of Authority — start DNS zone record, which contains information about the domain zone, its administrator’s address, serial number, etc.):
nslookup -type=soa theitbros.com
List all the available DNS records for the specified domain:
nslookup -type=any theitbros.com
Reverse DNS lookup (get the DNS record by an IP address):
nslookup 35.209.36.0
Change the default timeout interval for a reply:
nslookup -timeout=20 theitbros.com
Common Nslookup Errors
In this section, we list common errors that the nslookup tool may return:
- DNS request timed out — the name server doesn’t respond to the request after a certain time (timeout) and a certain number of attempts. You can set the request timeout using the set timeout subcommand. You can set the number of retry requests using the set retry.
- Non-existent domain — domain/host name does not exist;
- No response from the server — DNS server doesn’t respond to nslookup query;
- No records — there are no records on the DNS server for your query;
- Connection refused/ Network is unreachable — connection to DNS server not established;
- Server failure — the DNS server has encountered an internal error in its database and cannot provide an answer;
- Refused — the DNS server dropped the connection.
The nslookup is a powerful command for Windows administrators that allows you to find the IP address of any server by its DNS name, perform reverse DNS lookup, and get information about the various DNS records for a given domain name.
Cyril Kardashevsky
I enjoy technology and developing websites. Since 2012 I’m running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.
DNS, если вкратце, это система преобразования доменных имен, которые вы набираете в адресной строке веб-браузера, в IP-адреса. Существуют так же DNS-сервера, задача которых, получать запрос в виде доменного имени, и если данное имя есть в базе текущего сервера, то выдавать соответствующий данному имени IP-адрес(а). Если переданное имя не найдено, то сервер либо передает запрос по цепочке выше, к так называемому родительскому серверу (если данное поведение прописано в настройках текущего), либо посылает ответ, что данному имени не удалось сопоставить ни одного IP-адреса.
DNS-сервера прописаны в любой системе с выходом в интернет. Иначе мы не смогли бы открыть ни одни сайт введя его имя. Можно подумать, раз сервер прописан, либо выдан автоматически по DHCP, зачем вообще беспокоиться? Провайдер ведь не посоветует плохого.
Наверняка вы сталкивались с такой ситуацией когда сайт на который вы переходите очень долго грузится, но спустя некоторое время все же открывается. Или когда необходимый сайт грузится частично. А иногда сайты и вовсе не грузятся. Для исправления такого поведения, порою достаточно просто сменить DNS-сервер.
Как говорилось выше, DNS-сервер, это грубо говоря база имен с соответствующими им IP. Казалось бы все просто, но и здесь есть несколько важных нюансов.
Актуальность текущей базы имен — DNS-сервер должен всегда иметь максимально свежие данные о текущих доменах и их IP. Если к примеру за определенным именем будет закреплен уже не используемый IP, при попытке обращения к данному ресурсу вы получите сообщение что ресурс недоступен.
Производительность — DNS обрабатывает большое количество одновременных запросов, поэтому чем производительней машина(ы) на которой крутится DNS, тем быстрее будет происходить обработка поступающих обращений.
Географическое местоположение — В зависимости от страны в которой находится DNS-сервер, на него могут накладываться определенные ограничения, либо наоборот отсутствовать те что есть в вашей текущей стране. Кроме того, чем ближе к вам будет находится DNS тем быстрее вы получите от него ответ.
Надежность или стабильность — Хороший DNS-сервер должен иметь uptime (время работы без перерывов) близкий к 100%.
Блокировка нежелательных сайтов — К таким возможностям можно отнести например отсутствие в базе DNS сайтов содержащих вредоносный контент, либо контент для взрослых, либо все перечисленное разом.
Исходя из всего вышесказанного, выбор хорошего и быстрого DNS-сервера, будет совсем не лишним делом. И выбирать желательно DNS от крупных IT представителей, так как только они могут себе позволить все вышеперечисленные параметры.
Далее правой кнопкой мыши по активному сетевому соединению, и в открывшемся меню выбираем пункт Состояние. Либо же просто совершаем двойной клик левой кнопкой мыши.
В открывшемся окне нажимаем на кнопку Сведения.
Ту же самую информацию можно получить и с помощью командной строки. Команда ipconfig /all.
Как посмотреть прописанные DNS в Linux
Для вывода используемых DNS в ОС Linux нужно, открыть окно терминала, и ввести команду cat /etc/resolv.conf.
Команда NSLOOKUP
NSLOOKUP позволяет получить IP-адрес по имени хоста, либо наоборот, имя хоста по указанному IP. Кроме этого, данная команда отображает с какого именно DNS сервера был получен ответ. Синтаксис команды одинаков для Windows и для Linux.
nslookup [IP или Имя_хоста]
Результаты в Windows.
Результаты в Linux.
Список серверов DNS
В сети присутствует огромное количество различных DNS-серверов. Я в этом разделе постараюсь привести некоторые из них. Представленный ниже список никак нельзя назвать законченным, и возможно, вы знаете еще парочку крутых DNS. Напишите о них в комментариях 😏.
Cloudflare DNS — https://1.1.1.1/ (https://www.cloudflare.com/dns/)
Появился на свет 1 апреля 2018 года. Позиционируется как быстрый, надежный и безопасный DNS. Обзор на этот DNS можно почитать тут и тут.
IPv4 / IPv6:
1.1.1.1 / 2606:4700:4700::1111
1.0.0.1 / 2606:4700:4700::1001
Quad9 DNS — https://www.quad9.net/
Безопасный и приватный. Создан в сотрудничестве компаний IBM, PCH (Packet Clearing House), GLOBAL CYBER ALLIANCE.
IPv4:
9.9.9.9
AdGuard DNS (DNS с блокировкой рекламы) — https://adguard.com/ru/adguard-dns/overview.html
Данный DNS защищает от рекламы, трекинга и фишинга. От этой же компании есть расширения для браузеров с аналогичным функционалом. Причем его можно назвать самым лучшим в среди конкурентов.
IPv4 / IPv6:
176.103.130.130 / 2a00:5a60::ad1:0ff
176.103.130.131 / 2a00:5a60::ad2:0ff
Google Public DNS — https://developers.google.com/speed/public-dns/
(https://developers.google.com/speed/public-dns/docs/using)
DNS от компании Google. Наверно самый часто используемый, так как легко запомнить.
IPv4 / IPv6:
8.8.8.8 / 2001:4860:4860::8888
8.8.4.4 / 2001:4860:4860::8844
Яндекс.DNS — https://dns.yandex.ru (https://dns.yandex.ru/advanced/)
DNS от Российской поисковой компании Яндекс. Так как контора не маленькая, у себя в наличии она имеет более 80 DNS-серверов, расположенных в разных городах и странах. Есть поддержка блокировки нежелательно содержимого в зависимости от типа используемого DNS.
Базовый | Безопасный | Семейный | |
IPv4 | 77.88.8.8 | 77.88.8.88 | 77.88.8.7 |
77.88.8.1 | 77.88.8.2 | 77.88.8.3 | |
IPv6 | 2a02:6b8::feed:0ff | 2a02:6b8::feed:bad | 2a02:6b8::feed:a11 |
2a02:6b8:0:1::feed:0ff | 2a02:6b8:0:1::feed:bad | 2a02:6b8:0:1::feed:a11 |
OpenDNS — https://www.opendns.com/
Данные DNS принадлежат компании Cisco.
IPv4 / IPv6:
208.67.222.222 / 2620:0:ccc::2
208.67.220.220 / 2620:0:ccd::2
Comodo Secure DNS — https://www.comodo.com/secure-dns/
DNS от компании занимающейся разработкой антивирусного ПО. Особенностью является наличие защиты от вредоносных ресурсов и вирусной рекламы.
IPv4:
8.26.56.26
8.20.247.20
Norton ConnectSafe — https://connectsafe.norton.com/
Еще один DNS от разработчиков антивирусного ПО. В отличии от предыдущего, у данного DNS есть разделение по типам.
IPv4 — Безопасный интернет:
199.85.126.10
199.85.127.10
IPv4 — Безопасный интернет + Защита от контента сексуального характера:
199.85.126.20
199.85.127.20
IPv4 — Безопасный интернет + Защита от контента сексуального характера + Прочее:
199.85.126.30
199.85.127.30
К Прочему в данном случае относится — зрелый контент, аборты, алкоголь, преступность, наркотики, совместное использование файлов, азартные игры, ненависть, самоубийство, табак или насилие.
FreeDNS — https://freedns.zone/en/
IPv4:
37.235.1.174
37.235.1.177
Freenom — http://www.freenom.com/ru/index.html?lang=ru
IPv4:
80.80.80.80
80.80.81.81
FDN — https://www.fdn.fr/actions/dns/
IPv4 / IPv6:
80.67.169.12 / 2001:910:800::12
80.67.169.40 / 2001:910:800::40
DNS.WATCH — https://dns.watch/index
IPv4 / IPv6:
84.200.69.80 / 2001:1608:10:25::1c04:b12f
84.200.70.40 / 2001:1608:10:25::9249:d69b
VERISIGN — https://www.verisign.com/en_US/security-services/public-dns/index.xhtml
IPv4:
64.6.64.6
64.6.65.6
DNSReactor — http://dnsreactor.net/
IPv4:
104.236.210.29
45.55.155.25
Как прописать DNS в Windows
Переходим в список сетевых адаптеров
[Win + X] — Панель управления — Центр управления сетями и общим доступом — Изменения параметров адаптера
. Выбираем необходимое сетевое подключение, нажимаем по нему правой кнопкой мыши и переходим по пункту Свойства.
В открывшемся окне, в списке компонент выбираем IP версии 4 (TCP/IPv4) для того чтобы прописать IPv4 DNS, или IP версии 6 (TCP/IPv6) для того чтобы прописать IPv6 DNS.
Нажимаем на кнопку Свойства. В открывшемся окне, выставляем переключатель в положение Использовать следующие адреса DNS-серверов, и прописываем IP нужного вам DNS.
Подтверждаем настройки нажатием на кнопку Ok в этом и предыдущим окне.
Выполняем очистку DNS-кэша выполнив команду ipconfig /flushdns.
Итог
Какой именно DNS использовать, или какой самый лучший, вопрос немного сложный. Я, на данный момент, использую Comodo Secure DNS, так как с другими некоторые ресурсы у меня работали некорректно и медленно. Все зависит от вашего провайдера, поэтому пробовать варианты все равно придется. На этом пожалуй все 😉…
Improperly configured DNS (name) servers can effectively render your machine useless as you will be cut from all network resources outside your local network. In case that your machine using the DHCP client (i.e., the dynamic IP settings), you’re probably good. What about servers and any other device with the static IP address?
I promise you mighty tricks using the command line Kung-Fu. Let’s begin!
Although the dynamic IP assignment can be used even with servers, most servers are configured with the manually entered static IP address. Let assume that you need to check and confirm those settings on many servers, like 200 devices. What will you do?
Sure, you can log in to every Windows server, then you need to open Network and Sharing Centre, find the appropriate network adapter, open its properties and scroll down to check the DNS servers. Boring and time consuming.
What if you can do the same with only one command? Yes, you can achieve it and I love those power single line commands.
The classics – ipconfig
We will open the command prompt. You even don’t need the admin privileges, as we will only read the information.
The first command is the well-known ipconfig. We will add the /all option.
However, the output can be a very long and confusing, as you can see on the screenshot. We need to scroll down to find the correct adapter and its settings.
After a while, we found that particular information about the DNS servers.
The netsh command
The first way is using the old netsh command. In this case, we will use the context interface ipv4. Our command will look like this:
netsh interface ipv4 show dnsservers
The output is more concise, and we can find the necessary information on one screen.
The power shell way
The second method is to use the power shell. The command is very simple – Get-DNSClientServerAddress. No parameters needed.
As you can see, this command will also print a very short report. Even better, this command works with any Windows since version 8.1/2012R2 Server onward.
The Linux way
In case that you need to check the Linux server for the configured DNS servers, you need to execute one command:
cat /etc/resolv.conf
The output will enlist all defined servers.
Yes, DNS servers are named nameserver in Linux.
Now you know how to check for DNS servers, yet you can check in the similar way other network parameters. There are commands to set/update values, if needed.
And to make everything more interesting, next time I will show you how to execute those Windows commands through the remote shell, without necessity to login through RDP on each and every server.
Stay tuned.
Do you know how to find the IP addresses of your DNS servers? Would you like to learn how to do that? If you are a Windows 11 or Windows 10 user, there are many methods to find the addresses of the DNS servers that your computer or device is using. You can find this information in the Settings app, by running a command in PowerShell, and by other means. For more details on this subject, read this tutorial:
NOTE: If you don’t know what DNS servers are, you might want to read this article first: What is DNS? How is it useful?. If you got here looking for ways to change your DNS servers, here’s How to change DNS settings in Windows.
1. How to find your DNS servers in Windows 11 via Settings
If you’re using Windows 11, the Settings app offers one of the easiest ways to determine your DNS. So, start by opening Settings: you can launch it quickly by clicking/taping on its Pinned button from the Start Menu or using the Windows + I keyboard shortcut.
The Settings shortcut from Windows 11’s Start Menu
In the Settings app, select Network & internet on the left sidebar, and click or tap Properties on the right, next to the name of your current network connection.
Opening the Properties of current network connection
Alternatively, in the list on the right of the Settings app, click or tap on the entry corresponding to your network connection type. If you connect via Wi-Fi, press Wi-Fi; if you connect through a wired network connection, click or tap Ethernet.
Access the settings for Wi-Fi or Ethernet
Either way, you’ll get to a page that shows all your Wi-Fi or Ethernet network connections, depending on which one you accessed. Click or tap on the name of your connection to see its details.
The network connection currently in use
On the network connection’s page, scroll down to the bottom of the page. There, you’ll find what your IPv6 DNS servers and IPv4 DNS servers are.
Windows 11 DNS servers are listed in the Settings app
TIP: Here’s how to find your public IP address in Windows 11 and Windows 10.
2. How to find your DNS servers in Windows 10 via Settings
Similarly, one of the most straightforward ways to find your DNS in Windows 10 is to check your network connection information in the Settings app. Start by opening Settings: click or tap on its button from the Start Menu or press Windows + I on your keyboard.
The Settings button from Windows 10’s Start Menu
In the Settings app, open the Network & Internet category.
The Network & Internet category from Windows 10’s Settings
On the left side of the window, select the network connection for which you want to check the DNS settings. If you’re using a wired network connection, you should select Ethernet. Otherwise, if you’re using a wireless network connection, go to Wi-Fi. Then, click or tap on your network connection on the right side of the window.
The network to which the Windows 10 PC is connected
This opens a page that shows the details of your network connection. Scroll down to get to the Properties section. Look at the information displayed there, and you should find the details of your DNS: both the IPv4 DNS server address and the IPv6 DNS server address.
The DNS servers used by the network connection
3. How to find your DNS in Windows 11 from the Advanced network settings
There’s also another place in Windows 11’s Settings app where you can find what your DNS is: the Advanced network settings. Launch Settings (Windows + I), head to Network & internet and click or tap on Advanced network settings at the bottom of the list on the right.
How to open Advanced network settings in Windows 11
On the Advanced network settings page, look for your network card in the Network adapters list. When you find it, click or tap on its name or the small arrow to its right.
Click or tap on the network adapter currently in use
This will make Settings show you additional information and options for the selected network adapter. Click or tap on View additional properties.
View additional properties of a network adapter
The Settings app will then let you see additional properties of the network adapter you selected earlier. Among them, you’ll also find the DNS servers used by your Windows 11 PC.
How to check what DNS servers are used by Windows 11
4. How to find your DNS from the Network Connections window
The Network Connections window offers you another way to check your DNS settings in both Windows 11 and Windows 10.
If you’re using Windows 11, launch Settings (Windows + I), select Network & internet on the left sidebar, and click or tap Advanced network settings on the right.
Open Advanced network settings in Windows 11
Scroll down and click or tap the More network adapter options link under Related settings.
More network adapter settings
If you’re using Windows 10, open the Settings app and go to Network & Internet. Then, click or tap the Change adapter options button on the Status page.
The Change adapter options button from the Status page
Whether you use Windows 11 or Windows 10, the earlier steps open the Network Connections window. Inside it, double-click or double-tap on the network adapter for which you want to find the DNS settings. In our case, that would be the Wi-Fi network adapter highlighted below.
Opening the Status of a network connection
The previous action opens another window that shows you the Status of the selected network adapter. On it, click or tap on the Details button from the Connection area. Then, in the Network Connection Details window, you can find which DNS servers your Windows 11 or Windows 10 computer or device is using. They are listed next to IPv4 DNS Server and IPv6 DNS Server.
The DNS servers used by a network connection
5. How to find your DNS using the Network and Sharing Center
Another way to find the IP addresses of your DNS servers is via the Network and Sharing Center. And it works the same way in Windows 11 and Windows 10. Open the Network and Sharing Center (Control Panel > Network and Internet > Network and Sharing Center) and click or tap on the network adapter you use to connect to the internet. In our case, for example, that would be the Wi-Fi adapter.
Opening the Status of a network connection from the Network and Sharing Center
This opens the same Status window we’ve shown you in the previous method in this article. Click or tap on the Details button. Then, the Network Connection Details window shows you the DNS servers used by your Windows 11 or Windows 10 computer or device in the text lines called IPv4 DNS Server and IPv6 DNS Server.
The IP addresses of the DNS servers
6. How to find your DNS with the ipconfig command
We have a slightly faster way of finding out which DNS servers you use on your Windows 11 or Windows 10 computer or device. Open the standalone Command Prompt or PowerShell, or open a tab for either of them in Windows Terminal. Then, in the command-line environment, run this command:
ipconfig /all
Then, look through the information displayed, and you should find both the IPv4 and IPv6 DNS servers used by all your network adapters.
Running the ipconfig command to find the DNS servers in CMD
7. How to find your DNS servers with a dedicated PowerShell command
In the end, probably the fastest way to find your DNS servers in either Windows 11 or Windows 10 is offered by PowerShell. Open it, and run this command:
Get-DnsClientServerAddress
This will instantly show you all the DNS servers used by all your network adapters (both IPv4 and IPv6).
Find the DNS servers in PowerShell
That’s it!
What’s your favorite way of finding your DNS servers?
Now you know not one or two but seven different methods of finding out the IP addresses of your local DNS servers. Which is your preferred one? Do you know others that we might have missed? Don’t hesitate to leave a comment below and let us know.
When you are searching for a domain name or loading your favorite websites, it is the DNS (Domain Name System) server that is responsible for making it possible in your system. Your Windows 11 device has IPv4 and IPv6 DNS servers assigned to the network adaptor. In a case where you subscribe to the Internet Service Provider (ISP), the device users their DNS server by default. You can find out which server is used and even change it as well. This article presents various options guiding you on how to find DNS servers used in Windows 11 device of yours.
Page Contents
The used DNS server in your system could be custom DNS for the browsers (like Google Chrome, Firefox, Microsoft Edge), or connected to the VPN, to the router, or could be the one provided by your ISP. To find out which server is used in your Windows 11 device, there are following six different options along with step-by-step process on how to go about them.
Option-1: Settings Application to find DNS Servers
- First, Open the Settings Application and go to Network & Internet.
- Here, tap on Properties for the connected Network as shown in the screenshot below.
- Now click on the network connection that you want to know the DNS server details for. It will expand and show you the details of the IPv4 DNS Servers and IPv6 DNS server addresses used by this network.
Option-2: Network Connections in Control Panel to find DNS servers
- Open the Control Panel by searching for it in the windows Menu.
- Here, go to Network and Sharing Center.
- Now, click on Change Adapter Settings in the left side of the screen.
- Click on the network adaptor you want to know the DNS server details for.
- In the box that opens, click on details… to find out about the DNS servers used by this network connection.
Option-3: Advanced Network Settings
- Using the settings application, go to the Network & Internet section and click on Advanced Network Settings.
- Here, from the list of Network Adaptors, choose the one you wish to know the details for. Once it expands, click on View additional Properties.
You will be able to see the IPv4 and IPv6 DNS details for this network connection.
Option-4: Using “Get-DnsClientServerAddress” command
- Search for Windows Powershell in the Start Menu and open it.
- Type the command mentioned below in the black window that opens and press Enter.
Get-DnsClientServerAddress | Format-Table -AutoSize
You will be able to see DNS server details for all the Networks used on your device.
Option-5: Using “ipconfig” command
- This method can be carried out with the help of Windows Powershell or the Command Prompt. Search for either in the Start Menu and run it as administrator.
- In the black window that opens, write the following command and press Enter.
ipconfig /all
This will show all Server address used by all available network adaptors.
Option-6: Through Network and Sharing Center
- Open the Control Panel from the Windows menu and go to the Network & Sharing Center as shown in option 2.
- In this screen, click on the network connection link that you will find next to the connection for which you wish to know the DNS server address details.
- You will see a box as shown in option 2. Click on Details…
Hence, we have covered six different ways to guide you on how to find can find DNS servers used in Windows 11 device.