HowTo: Find Out DNS Server IP Address Used By My Router?

My router configured by ISP tech and it is set to get DNS server address automatically from upstream. Is there is a way to find out the IP address of the dns server used by my router which is located at Is there Linux, Unix, Apple OS X, or MS-Windows command that I can use get the same information?

Domain Name System (DNS) is an Internet service that translates domain names into IP addresses or vice versa.
Tutorial details
Difficulty level Intermediate
Root privileges No
Requirements None
Est. reading time 5m
The easiest way to find out your dns server IP address is to go through the router’s admin interface status page. All routers have a built-in web-based setup page that allows the user to customize settings and set view properties such as IP address and dns settings.

Method #1: Router’s Webgui Status Page (Recommended for all users)

You can use router’s web gui page to find out dns server IP address assigned by your ISP.

  • First, open a web browser (use your computer’s web browser such as Firefox, Google Chrome, or Internet Explorer).
  • Type the router’s IP address on the Address bar on top then press Return ([Enter] key] on your keyboard. In most cases the router’s default IP address is (see how to find out router’s IP address under MS-Windows and Unix like operating system).
  • Enter your router’s username and password when prompted.
  • You should see router page like the one below (the page varies depending on the router make and model).
What Is My Router's DNS Server IP Address?

Fig.01: My linksys home router

  • Finally, click on Status to view dns address assigned by your ISP. You should see status page like one below (again page output varies on the router make and model but you should able to see dns server IP address)

Fig.02: My linksys router's dns server settings assinged by my isp

Method # 2: MS-Windows Commands

Open a command prompt (click on Start > run > type cmd and press [enter] key to open a command prompt).

Type the nslookup command to check DNS resolution at the command prompt c:>
Sample outputs:


Non-authoritative answer:

The first two lines are the dns server ( or you are using i.e. dns server IP address assigned by your ISP or network admin. is our own dns server located inside our corporate network.

Say hello to ipconfig /all command

Another option is to type ipconfig /all command at the command prompt to get the same information:
ipconfig /all
Sample outputs:

Fig.03: MS-Windows command to find out DNS server IP addresses

In this example my DNS server is located at This one is used by my computer, and it was passed on to my computer by ISP modem / router.

Method #3: Apple OS X or Unix / Linux Commands

Open the bash shell prompt and type the dig or host commands:
$ host -a | grep from
Sample outputs:

Received 229 bytes from in 0 ms

OR use the dig command:
$ dig | grep SERVER
Sample outputs:


However, a better approach is to go through /etc/resolv.conf file to see assigned dns server address to your computer. It was passed on to you by your modem / router:
$ cat /etc/resolv.conf
Sample outputs:

options single-request

(Fig.04: and are my DNS server IP address assigned under Unix like operating systems)

Method #4: Dump and view traffic on a network (recommended for advanced users only)

You can use the tcpdump command to dump traffic on a network and view dns traffic. tcpdump command works on most Unix-like operating systems. tcpdump command analyzes network behavior, performance and applications that generate or receive network traffic including dns traffic. To view dns traffic only run tcpudmp as root user in a separate window:
# tcpdump udp and src port 53
# tcpdump udp and dst port 53
# tcpdump -n -s 1500 -i eth0 udp port 53

Open another window (terminal) and run host / dig commands to generate dns traffic:
$ host
Sample outputs:

Fig.05: Tcpdump in action - monitoring udp port # 53 traffic

In this example:
  1. You see all packets going in and out of my Linux system for udp port # 53.
  2. I ran host command from another windows.
  3. The output of tcpdump clearly indicate that my computer (IP: asking to dns server (IP: about the address of In second line I got answer from dns server.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 28 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
28 comments… add one
  • Bangolio Apr 24, 2012 @ 21:33

    Don’t take this the wrong way since I really love this website but:
    1. This is not *nix related which is fairly disappointing.
    2. Some home routers work as a cache DNS; They issue queries to the DNS servers, cache the result and send it back to you.
    3. Since you wrote it anyway, I would add some free public DNS addresses (ie OpenDNS, Google, Symantec etc).

    • 🐧 nixCraft Apr 24, 2012 @ 21:40

      Yes, I know. I get this question asked way too often. So, I decided to add it to our FAQ section. Don’t worry, I’m not switching to other oses.

      I appreciate your comment.

      • Bangolio Apr 24, 2012 @ 23:32

        Thanks man, you’re awesome and this site is great!

        • ttt Apr 25, 2012 @ 12:01

          tcpdump, dig, host and other commands are *nix specific. Isn’t it?

  • Scott Apr 26, 2012 @ 23:01

    This is very relevant to Linux/Unix. Carry on! Great blog,

    • Bangolio Apr 27, 2012 @ 12:58

      Part of it is relevant to *nix, I was just saying that part of it isn’t as there is a Windows section and a router section.
      I don’t have anything specifically against that, I was merely pointing out that it’s not relevant to the site.
      It’s not that big of a deal but imagine if this post was about DNS facilities in Linux and you had explanations about the dnsdomainname command, hosts file, hostname command, resolv.conf (explaning the useful search domain feature and options) and so on, that would be a lot more appropriate.

      But again, it’s not like this is hurting anyone, Vivek said he posted this because he was getting this question too much so that’s good.

  • Wendy Merritt Jul 7, 2012 @ 22:32

    I had been searching for this information for this information for a few minutes. Thanks for having exactly what I needed! Awesome! I am back in business now!

  • john doe Aug 21, 2013 @ 9:03

    thanks for the info menh you were of extreme help in ma project thanks again

  • Allen Ellison Aug 31, 2013 @ 6:34

    Above you mention the Mac OS X resolv.con file. It is actually called resolv.conf

    • 🐧 nixCraft Aug 31, 2013 @ 8:08

      Thanks for the heads up!

      • George Florin Apr 21, 2015 @ 18:23

        How do I shut off my dns and anything else that makes hackers have easy acess. How do you remove viruses I’m disabled and can’t afford to get beat by these inpostors

        • Steve Jul 31, 2015 @ 5:15

          Hi George – DNS is vital to internet browsing – without it, you won’t be able to effectively get on line. It’s perhaps easiest to think of it as your networks ‘sat nav’; you enter where you want to go (e.g. and DNS works out how to get there (by translating the ‘address’ into something that is ‘routable’ via the internet). You don’t need to ‘shut off’ DNS. Just make sure you’re using a good anti-virus program and keep your security updates up-to-date and you should be fine :-)

        • Nostromov Jan 27, 2017 @ 23:54

          Always use a firewall, Comodo has a convenient one where “Firewall” can be set to Custom Ruleset (with full prompts, option can be set during install, or after through configuration), “Auto-Sandbox” is good to keep Enabled, “HIPS” and “Viruscope” can be set to Disabled, not to be a drag. :)

  • Rick Jan 9, 2014 @ 3:48

    What if Method #1 and #2 give different IP addresses? I have a 2Wire router with AT&T U-verse and from the routers status page I get the following (from under Settings->Broadband->Status:
    Subnet Mask
    Default Gateway
    Primary DNS
    Secondary DNS

    From the windows cmd ipconfig /all this is what I get:
    Subnet Mask
    Default Gateway
    DNS Servers (same as above)

    All the addresses are different in both versions. Which one is correct and why are they giving numbers?

    • Anwar muhidin Jul 29, 2020 @ 8:13

      I need DNS address

  • Rick Jan 9, 2014 @ 3:49

    I meant “why are they giving different numbers?”

    • 🐧 Nix Craft Jan 9, 2014 @ 6:01

      Your 2Wire router router act as all-in-one gateway server. It has in-built caching dns server and it is used to speed up dns queries. It also saves load on remote ISP dns server such as and

  • bradley naveau Mar 25, 2014 @ 7:30

    i needed to find out how to find my computers dns server but all the forums and help already expected me to know the dns server, how do i find this information in my computer. thanks for any replies and if not this site is a waste of time.

  • finite9 Apr 11, 2014 @ 10:32

    I run a pfSense router and Fedora client. When I use dig or cat resolv.conf, i’m only getting the router IP, not the actual DNS server used.

    I can see which DNS IP’s i’ve configured in pfSense, but how to I actually verify that they are being used?

    Do I have to ssh into the router and cat resolv.conf there? (cannot try this at mo, cuz i dont have remote admin enabled)

  • Renato Freitas May 12, 2014 @ 22:52

    You can also use Wireshark to get content of dns protocol

  • martha Jun 14, 2014 @ 3:46

    Please help me with my google play updates

  • Kristie Jun 21, 2014 @ 1:55

    I have tried all of these steps plus more and I just keep getting ” such n such is not recognized as an internal or external command ” why is that? I can not log onto the internet from my desktop but from my lap top and phones everything works fine. On my desk top it says ” Little or no connectivity and then when I use the repair option it comes back saying it could not finish renewing my IP address. please help if you can! Thank you

  • kix Dec 17, 2014 @ 7:03

    as i do not have much knowledge about what is DNS | IP address, MAC, etc. i just wanna ask you guys on how to know which ISP am using (airtel, mtnl etc) can somebody tell me.. i know its a silly question.? but i’m curious ..

  • Shams Jan 28, 2015 @ 15:02

    great detail explanation
    Thank you

  • Neville Scollop Oct 12, 2015 @ 6:47

    Any Indian guys I speak to in Europe have never heard of Linux and only use Microsoft. Why is that?

  • Zenmap user Apr 21, 2016 @ 12:19

    The issue with:

    Only ethernet devices can be used for raw scans on Windows, and “ppp0” is not an ethernet device. Use the –unprivileged option

    Is caused when using Nmap on Windows in cases where no DNS is available.
    This happens when you are using Nmap by a VPN. In the VPN is no DNS set as a security measure. Using the DNS of your IPS is pointless because it can not find
    someting on the VPN.
    It is a silly situation because if you set the target IP address no DNS should be needed.

    It is an Nmap implementation error. Nmap was designed for Linux.
    If you use Nmap on Linux you do not have this problem.

  • Rumboogy Sep 15, 2017 @ 22:55

    Great article.

    Question – your methods all show the local router as being the source for resolving DNS queries. But how can you tell what DNS your router is using (other than looking in the router’s config)? I am unsure what my router is doing w/r/t DNS and I would like some way to verify this.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum