{"id":10250,"date":"2023-08-06T22:58:35","date_gmt":"2023-08-07T03:58:35","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=10250"},"modified":"2023-08-09T22:59:24","modified_gmt":"2023-08-10T03:59:24","slug":"linux-disabling-wild-local-dns-server-thing-i-e-systemd-resolved","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=10250","title":{"rendered":"Linux: Disabling Wild Local DNS Server Thing (i.e. systemd-resolved)"},"content":{"rendered":"<p>I am certain there is some way to configure systemd-resolved to actually use internal DNS servers so you can resolve your local hostnames. But nothing I&#8217;ve tried have worked, and I don&#8217;t actually need this wild local DNS thing.<\/p>\n<p>Here&#8217;s the problem &#8212; systemd-resolved creates an \/etc\/resolv.conf file that uses a localhost address as the nameserver &#8212; and that may very well forward requests out to Internet DNS servers. Which don&#8217;t have any clue about your internal DNS zones &#8212; thus you can no longer resolve local hostnames. Whenever I see 127.0.0.53 in \/etc\/resolv.conf, I know systemd-resolved is at work.<\/p>\n<pre>[lisa@linux ~]# cat \/etc\/resolv.conf\r\n# This is \/run\/systemd\/resolve\/stub-resolv.conf managed by man:systemd-resolved(8).\r\n# Do not edit.\r\n#\r\n# This file might be symlinked as \/etc\/resolv.conf. If you're looking at\r\n# \/etc\/resolv.conf and seeing this text, you have followed the symlink.\r\n#\r\n# This is a dynamic resolv.conf file for connecting local clients to the\r\n# internal DNS stub resolver of systemd-resolved. This file lists all\r\n# configured search domains.\r\n#\r\n# Run \"resolvectl status\" to see details about the uplink DNS servers\r\n# currently in use.\r\n#\r\n# Third party programs should typically not access this file directly, but only\r\n# through the symlink at \/etc\/resolv.conf. To manage man:resolv.conf(5) in a\r\n# different way, replace this symlink by a static file or a different symlink.\r\n#\r\n# See man:systemd-resolved.service(8) for details about the supported modes of\r\n# operation for \/etc\/resolv.conf.\r\n\r\nnameserver 127.0.0.53\r\noptions edns0 trust-ad\r\nsearch example.com<\/pre>\n<p>To disable this local name resolution, stop and disable systemd-resolved, unlink the \/etc\/resolv.conf file it created, and restart NetworkManager<\/p>\n<pre>[lisa@linux ~]# systemctl stop systemd-resolved.service\r\n[lisa@linux ~]# systemctl disable systemd-resolved.service\r\n[lisa@linux ~]# unlink \/etc\/resolv.conf\r\n[lisa@linux ~]# systemctl restart NetworkManager\r\nRemoved \/etc\/systemd\/system\/multi-user.target.wants\/systemd-resolved.service.\r\nRemoved \/etc\/systemd\/system\/dbus-org.freedesktop.resolve1.service.<\/pre>\n<p>Voila, \/etc\/resolv.conf is now populated with reasonable internal DNS servers, and you can resolve local hostnames.<\/p>\n<pre>[lisa@linux ~]# cat \/etc\/resolv.conf\r\n# Generated by NetworkManager\r\nsearch example.com\r\nnameserver 10.1.2.33\r\nnameserver 10.1.2.66<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I am certain there is some way to configure systemd-resolved to actually use internal DNS servers so you can resolve your local hostnames. But nothing I&#8217;ve tried have worked, and I don&#8217;t actually need this wild local DNS thing. Here&#8217;s the problem &#8212; systemd-resolved creates an \/etc\/resolv.conf file that uses a localhost address as the &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[100,1895],"class_list":["post-10250","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-dns","tag-systemd-resolved"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10250"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10250\/revisions"}],"predecessor-version":[{"id":10251,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10250\/revisions\/10251"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}