This is a text-only version of the following page on https://raymii.org:
---
Title       :   Match dig 127.0.0.53 server with systemd-resolvd server
Author      :   Remy van Elst
Date        :   23-05-2019
URL         :   https://raymii.org/s/snippets/Match_dig_127.0.0.53_server_with_systemd-resolved_server.html
Format      :   Markdown/HTML
---




On systems that use `systemd-resolved` for DNS you will see the
`127.0.0.53` IP address in dig output. dig is a tool to do DNS lookups,
and for troubleshooting it's usefull to see which server is being queried.
With `systemd-resolved`, you need to issue another command to view the actual
server that is being queried, since `systemd-resolved` also acts as a local
caching server.


<p class="ad"> <b>Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:</b><br><br> <a href="https://leafnode.nl">I'm developing an open source monitoring app called  Leaf Node Monitoring, for windows, linux & android. Go check it out!</a><br><br> <a href="https://github.com/sponsors/RaymiiOrg/">Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.</a><br><br> <a href="https://www.digitalocean.com/?refcode=7435ae6b8212">You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days. </a><br><br> </p>


### dig query

Using the following example of a default dig query you will see in the output a
line saying "SERVER", which is the server answering the query:

   $ dig A raymii.org

   ; <<>> DiG 9.11.3-1ubuntu1.7-Ubuntu <<>> A raymii.org
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23416
   ;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 1

   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 65494
   ;; QUESTION SECTION:
   ;raymii.org.            IN  A

   ;; ANSWER SECTION:
   raymii.org.     300 IN  A   45.32.136.37
   raymii.org.     300 IN  A   80.211.96.38
   raymii.org.     300 IN  A   116.203.75.71
   raymii.org.     300 IN  A   199.19.225.3
   raymii.org.     300 IN  A   185.121.24.135
   raymii.org.     300 IN  A   212.47.241.60
   raymii.org.     300 IN  A   128.199.39.10

   ;; Query time: 12 msec
   ;; SERVER: 127.0.0.53#53(127.0.0.53)
   ;; WHEN: Thu May 23 09:07:29 CEST 2019
   ;; MSG SIZE  rcvd: 151


This line:

   ;; SERVER: 127.0.0.53#53(127.0.0.53)

If we give dig a specific DNS server to query you will see that reflected in
the output:

   $ dig A raymii.org @8.8.8.8

   ; <<>> DiG 9.11.3-1ubuntu1.7-Ubuntu <<>> A raymii.org @8.8.8.8
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63820
   ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 1

   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 512
   ;; QUESTION SECTION:
   ;raymii.org.            IN  A

   ;; ANSWER SECTION:
   raymii.org.     286 IN  A   116.203.75.71
   raymii.org.     286 IN  A   185.121.24.135
   raymii.org.     286 IN  A   212.47.241.60
   raymii.org.     286 IN  A   199.19.225.3
   raymii.org.     286 IN  A   45.32.136.37
   raymii.org.     286 IN  A   128.199.39.10
   raymii.org.     286 IN  A   80.211.96.38

   ;; Query time: 9 msec
   ;; SERVER: 8.8.8.8#53(8.8.8.8)
   ;; WHEN: Thu May 23 09:09:01 CEST 2019
   ;; MSG SIZE  rcvd: 151

The line now reflects the google dns:

   ;; SERVER: 8.8.8.8#53(8.8.8.8)

### systemd-resolved

When debugging, for example when an internal DNS server gives different results,
you would want to know which internal dns server answered the request, instead
of seeing that it was your local resolver. If you are using `systemd-resolved`
(default on Ubuntu 18.04) the following command will show the actual upstream
DNS server (received from DHCP) used:

   systemd-resolve --status | grep "DNS Servers"

Example output:

        DNS Servers: 192.168.55.254

If you have more than one network interface you will need to look at the full
command output.




---

License:
All the text on this website is free as in freedom unless stated otherwise.
This means you can use it in any way you want, you can copy it, change it
the way you like and republish it, as long as you release the (modified)
content under the same license to give others the same freedoms you've got
and place my name and a link to this site with the article as source.

This site uses Google Analytics for statistics and Google Adwords for
advertisements. You are tracked and Google knows everything about you.
Use an adblocker like ublock-origin if you don't want it.

All the code on this website is licensed under the GNU GPL v3 license
unless already licensed under a license which does not allows this form
of licensing or if another license is stated on that page / in that software:

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.

Just to be clear, the information on this website is for meant for educational
purposes and you use it at your own risk. I do not take responsibility if you
screw something up. Use common sense, do not 'rm -rf /' as root for example.
If you have any questions then do not hesitate to contact me.

See https://raymii.org/s/static/About.html for details.