{"id":4856,"date":"2021-04-12T21:58:53","date_gmt":"2021-04-12T20:58:53","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=4856"},"modified":"2021-04-12T21:58:54","modified_gmt":"2021-04-12T20:58:54","slug":"linux-default-dns-server","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/linux-default-dns-server\/","title":{"rendered":"Linux Default DNS server"},"content":{"rendered":"\n<p>Source: <a href=\"https:\/\/www.linuxbabe.com\/ubuntu\/set-up-local-dns-resolver-ubuntu-20-04-bind9\">https:\/\/www.linuxbabe.com\/ubuntu\/set-up-local-dns-resolver-ubuntu-20-04-bind9<\/a><\/p>\n\n\n\n<p>Systemd-resolved provides the stub resolver on Ubuntu 20.04. As mentioned in the beginning of this article, a stub resolver is a small DNS client on the end-user\u2019s computer that receives DNS requests from applications such as Firefox and forward requests to a recursive resolver.<\/p>\n\n\n\n<p>The default recursive resolver can be seen with this command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemd-resolve --status<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.linuxbabe.com\/wp-content\/uploads\/2020\/04\/local-dns-resolver-ubuntu-20.04.png\" alt=\"local-dns-resolver-ubuntu-20.04\" class=\"wp-image-19808\"\/><\/figure><\/div>\n\n\n\n<p>Hint: If the above command doesn\u2019t quit immediately, you can make it quit by pressing the Q key.<\/p>\n\n\n\n<p>As you can see, BIND isn\u2019t the default. If you run the following command on the BIND server,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dig A facebook.com<\/pre>\n\n\n\n<p>This DNS query can\u2019t be found in BIND log. Instead, you need to explicitly tell dig to use BIND.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dig A facebook.com @127.0.0.1<\/pre>\n\n\n\n<p>To set BIND as the default resolver, open the systemd-resolved configuration file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/systemd\/resolved.conf<\/pre>\n\n\n\n<p>In the <code>[Resolve]<\/code> section, add the following line. This will set a global DNS server for your server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DNS=127.0.0.1<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.linuxbabe.com\/wp-content\/uploads\/2019\/01\/bind-dns-resolver.png\" alt=\"bind dns resolver\" class=\"wp-image-17248\"\/><\/figure><\/div>\n\n\n\n<p>Save and close the file. Then restart systemd-resolved service.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart systemd-resolved<\/pre>\n\n\n\n<p>Now run the following command to check the default DNS resolver.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemd-resolve --status<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.linuxbabe.com\/wp-content\/uploads\/2020\/04\/bind9-recursive-resolver-ubuntu-20.04.png\" alt=\"bind9-recursive-resolver-ubuntu-20.04\" class=\"wp-image-19809\"\/><\/figure><\/div>\n\n\n\n<p>Now perform a DNS query without specifying <code>127.0.0.1<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dig A facebook.com<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/www.linuxbabe.com\/ubuntu\/set-up-local-dns-resolver-ubuntu-20-04-bind9 Systemd-resolved provides the stub resolver on Ubuntu 20.04. As mentioned in the beginning of this article, a stub resolver is a small DNS client on the end-user\u2019s computer that receives DNS requests from applications such as Firefox and forward requests to a recursive resolver. The default recursive resolver can be seen with this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4856","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/4856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=4856"}],"version-history":[{"count":1,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/4856\/revisions"}],"predecessor-version":[{"id":4857,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/4856\/revisions\/4857"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=4856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=4856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=4856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}