How to disable systemd-resolved and resolve DNS with dnsmasq?
up vote
15
down vote
favorite
Ubuntu 16.10+ uses systemd-resolved as DNS resolver.
I prefer the setup 16.04 uses, dnsmasq as the resolver.
How can I do that on 16.10+, especially on 17.04?
16.10 dns dnsmasq 17.04 systemd-resolved
add a comment |
up vote
15
down vote
favorite
Ubuntu 16.10+ uses systemd-resolved as DNS resolver.
I prefer the setup 16.04 uses, dnsmasq as the resolver.
How can I do that on 16.10+, especially on 17.04?
16.10 dns dnsmasq 17.04 systemd-resolved
 
 
 
 
 
 
 Maybe this could help : askubuntu.com/questions/1032450/…
 – cmak.fr
 May 18 at 8:13
 
 
 
add a comment |
up vote
15
down vote
favorite
up vote
15
down vote
favorite
Ubuntu 16.10+ uses systemd-resolved as DNS resolver.
I prefer the setup 16.04 uses, dnsmasq as the resolver.
How can I do that on 16.10+, especially on 17.04?
16.10 dns dnsmasq 17.04 systemd-resolved
Ubuntu 16.10+ uses systemd-resolved as DNS resolver.
I prefer the setup 16.04 uses, dnsmasq as the resolver.
How can I do that on 16.10+, especially on 17.04?
16.10 dns dnsmasq 17.04 systemd-resolved
16.10 dns dnsmasq 17.04 systemd-resolved
edited Apr 1 '17 at 23:38


wjandrea
8,06142258
8,06142258
asked Mar 30 '17 at 20:28
Artyom
1,0231724
1,0231724
 
 
 
 
 
 
 Maybe this could help : askubuntu.com/questions/1032450/…
 – cmak.fr
 May 18 at 8:13
 
 
 
add a comment |
 
 
 
 
 
 
 Maybe this could help : askubuntu.com/questions/1032450/…
 – cmak.fr
 May 18 at 8:13
 
 
 
Maybe this could help : askubuntu.com/questions/1032450/…
– cmak.fr
May 18 at 8:13
Maybe this could help : askubuntu.com/questions/1032450/…
– cmak.fr
May 18 at 8:13
add a comment |
                                3 Answers
                                3
                        
active
oldest
votes
up vote
19
down vote
dnsmasq packages are still available in 16.10 and 17.04.
 - Install - dnsmasqand dependencies (or at least download their packages) before disabling- systemd-resolved:
 
 - sudo apt-get install dnsmasq
 
 
 - Disable - systemd-resolvedand verify- dnsmasqis running:
 
 - sudo systemctl stop systemd-resolved
 sudo systemctl disable systemd-resolved
 
 systemctl status dnsmasq
 
 
 - Season - dnsmasqto taste. After applying your settings, restart- dnsmasq:
 
 - sudo systemctl stop dnsmasq
 sudo systemctl start dnsmasq
 
 
After step 2 you might be without a working system resolver until step 3 is complete.  You may need to restart the networking subsystem (or simply reboot) to get dnsmasq functioning with the default configs.  In my testing, adding a known DNS server to /etc/dnsmasq.conf and restarting dnsmasq was enough to get it working in a liveCD environment.
 
 
 
 
 
 
 Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
 – bogl
 Apr 7 '17 at 15:46
 
 
 
 
 
 1
 
 
 
 
 For me, this was a great answer but also required the additional steps from @blabla's answer, adding- dns=dnsmasqconfig to- /etc/NetworkManager/NetworkManager.conf
 – Roberto Tyley
 Jun 11 '17 at 10:08
 
 
 
 
 
 
 
 
 
 Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
 – Alberto L. Bonfiglio
 Apr 3 at 22:31
 
 
 
add a comment |
up vote
11
down vote
In addition to the answer of @quixotic:
Make sure you have in /etc/NetworkManager/NetworkManager.conf :
[main]
dns=dnsmasq
if you need to add it, restart NetworkManager like this:
sudo systemctl restart NetworkManager
and /etc/resolv.conf needs to be a symlink to /var/run/NetworkManager/resolv.conf . could be done like this
sudo rm /etc/resolv.conf; sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
 
 
 
 
 
 
 Actually I have it set as- dns=defaultand it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.
 – pbhj
 Jun 10 '17 at 14:56
 
 
 
 
 
 1
 
 
 
 
 This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
 – Roberto Tyley
 Jun 11 '17 at 10:07
 
 
 
add a comment |
up vote
0
down vote
According to the manual of systemd-resolved, systemd-resolved provides with name resolution services via three different interfaces:
- "fully-featured API systemd-resolved exposes on the bus"
- "a local DNS stub listener on IP address 127.0.0.53 on the local loopback interface"
 - The glibc getaddrinfo(3) API as defined by RFC3493 and its related resolver functions, including gethostbyname(3). This API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC validation status information however, and is synchronous only. This API is backed by the glibc Name Service Switch (nss(5)). Usage of the glibc NSS module nss-resolve(8) is required in order to allow glibc's NSS resolver functions to resolve host names via systemd-resolved. 
 
It seems that the first two interfaces won't interfere in normal DNS resolution and for me the problem is likely to reside on the third.
In the manual of nss-resolve:
To activate the NSS module, add "resolve" to the line starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:" line (but after the "files" or "mymachines" entries), right before the "dns" entry if it exists, followed by "[!UNAVAIL=return]", to ensure DNS queries are always routed via systemd-resolved(8) if it is running, but are routed to nss-dns if this service is not available
So what is needed is to make "dns" precedes "resolve" in "host:" line of /etc/nsswitch.conf. And then getaddrinfo should simply adhere to /etc/resolv.conf .
This solution only prevents systemd-resolved from handling all the DNS resolution requests and is not restricted to a specific network manager. And it also makes sure LLMNR and mDNS service are operating normally.
( I am not fair familiar with how name resolution works under Linux and also unsure about what I understood from these manuals. Pleaes point out if I got something wrong. Thx :) )
add a comment |
                                3 Answers
                                3
                        
active
oldest
votes
                                3 Answers
                                3
                        
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
19
down vote
dnsmasq packages are still available in 16.10 and 17.04.
 - Install - dnsmasqand dependencies (or at least download their packages) before disabling- systemd-resolved:
 
 - sudo apt-get install dnsmasq
 
 
 - Disable - systemd-resolvedand verify- dnsmasqis running:
 
 - sudo systemctl stop systemd-resolved
 sudo systemctl disable systemd-resolved
 
 systemctl status dnsmasq
 
 
 - Season - dnsmasqto taste. After applying your settings, restart- dnsmasq:
 
 - sudo systemctl stop dnsmasq
 sudo systemctl start dnsmasq
 
 
After step 2 you might be without a working system resolver until step 3 is complete.  You may need to restart the networking subsystem (or simply reboot) to get dnsmasq functioning with the default configs.  In my testing, adding a known DNS server to /etc/dnsmasq.conf and restarting dnsmasq was enough to get it working in a liveCD environment.
 
 
 
 
 
 
 Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
 – bogl
 Apr 7 '17 at 15:46
 
 
 
 
 
 1
 
 
 
 
 For me, this was a great answer but also required the additional steps from @blabla's answer, adding- dns=dnsmasqconfig to- /etc/NetworkManager/NetworkManager.conf
 – Roberto Tyley
 Jun 11 '17 at 10:08
 
 
 
 
 
 
 
 
 
 Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
 – Alberto L. Bonfiglio
 Apr 3 at 22:31
 
 
 
add a comment |
up vote
19
down vote
dnsmasq packages are still available in 16.10 and 17.04.
 - Install - dnsmasqand dependencies (or at least download their packages) before disabling- systemd-resolved:
 
 - sudo apt-get install dnsmasq
 
 
 - Disable - systemd-resolvedand verify- dnsmasqis running:
 
 - sudo systemctl stop systemd-resolved
 sudo systemctl disable systemd-resolved
 
 systemctl status dnsmasq
 
 
 - Season - dnsmasqto taste. After applying your settings, restart- dnsmasq:
 
 - sudo systemctl stop dnsmasq
 sudo systemctl start dnsmasq
 
 
After step 2 you might be without a working system resolver until step 3 is complete.  You may need to restart the networking subsystem (or simply reboot) to get dnsmasq functioning with the default configs.  In my testing, adding a known DNS server to /etc/dnsmasq.conf and restarting dnsmasq was enough to get it working in a liveCD environment.
 
 
 
 
 
 
 Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
 – bogl
 Apr 7 '17 at 15:46
 
 
 
 
 
 1
 
 
 
 
 For me, this was a great answer but also required the additional steps from @blabla's answer, adding- dns=dnsmasqconfig to- /etc/NetworkManager/NetworkManager.conf
 – Roberto Tyley
 Jun 11 '17 at 10:08
 
 
 
 
 
 
 
 
 
 Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
 – Alberto L. Bonfiglio
 Apr 3 at 22:31
 
 
 
add a comment |
up vote
19
down vote
up vote
19
down vote
dnsmasq packages are still available in 16.10 and 17.04.
 - Install - dnsmasqand dependencies (or at least download their packages) before disabling- systemd-resolved:
 
 - sudo apt-get install dnsmasq
 
 
 - Disable - systemd-resolvedand verify- dnsmasqis running:
 
 - sudo systemctl stop systemd-resolved
 sudo systemctl disable systemd-resolved
 
 systemctl status dnsmasq
 
 
 - Season - dnsmasqto taste. After applying your settings, restart- dnsmasq:
 
 - sudo systemctl stop dnsmasq
 sudo systemctl start dnsmasq
 
 
After step 2 you might be without a working system resolver until step 3 is complete.  You may need to restart the networking subsystem (or simply reboot) to get dnsmasq functioning with the default configs.  In my testing, adding a known DNS server to /etc/dnsmasq.conf and restarting dnsmasq was enough to get it working in a liveCD environment.
dnsmasq packages are still available in 16.10 and 17.04.
 - Install - dnsmasqand dependencies (or at least download their packages) before disabling- systemd-resolved:
 
 - sudo apt-get install dnsmasq
 
 
 - Disable - systemd-resolvedand verify- dnsmasqis running:
 
 - sudo systemctl stop systemd-resolved
 sudo systemctl disable systemd-resolved
 
 systemctl status dnsmasq
 
 
 - Season - dnsmasqto taste. After applying your settings, restart- dnsmasq:
 
 - sudo systemctl stop dnsmasq
 sudo systemctl start dnsmasq
 
 
After step 2 you might be without a working system resolver until step 3 is complete.  You may need to restart the networking subsystem (or simply reboot) to get dnsmasq functioning with the default configs.  In my testing, adding a known DNS server to /etc/dnsmasq.conf and restarting dnsmasq was enough to get it working in a liveCD environment.
answered Apr 2 '17 at 5:18
quixotic
582410
582410
 
 
 
 
 
 
 Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
 – bogl
 Apr 7 '17 at 15:46
 
 
 
 
 
 1
 
 
 
 
 For me, this was a great answer but also required the additional steps from @blabla's answer, adding- dns=dnsmasqconfig to- /etc/NetworkManager/NetworkManager.conf
 – Roberto Tyley
 Jun 11 '17 at 10:08
 
 
 
 
 
 
 
 
 
 Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
 – Alberto L. Bonfiglio
 Apr 3 at 22:31
 
 
 
add a comment |
 
 
 
 
 
 
 Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
 – bogl
 Apr 7 '17 at 15:46
 
 
 
 
 
 1
 
 
 
 
 For me, this was a great answer but also required the additional steps from @blabla's answer, adding- dns=dnsmasqconfig to- /etc/NetworkManager/NetworkManager.conf
 – Roberto Tyley
 Jun 11 '17 at 10:08
 
 
 
 
 
 
 
 
 
 Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
 – Alberto L. Bonfiglio
 Apr 3 at 22:31
 
 
 
Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
– bogl
Apr 7 '17 at 15:46
Great answer, and seemingly the only solution when disabling NetworkManager is not acceptable!
– bogl
Apr 7 '17 at 15:46
1
1
For me, this was a great answer but also required the additional steps from @blabla's answer, adding
dns=dnsmasq config to /etc/NetworkManager/NetworkManager.conf– Roberto Tyley
Jun 11 '17 at 10:08
For me, this was a great answer but also required the additional steps from @blabla's answer, adding
dns=dnsmasq config to /etc/NetworkManager/NetworkManager.conf– Roberto Tyley
Jun 11 '17 at 10:08
Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
– Alberto L. Bonfiglio
Apr 3 at 22:31
Same here. After struggling with systemd-resolved and unbound switching to dnsmasq did the trick on ubuntu 17.10. I did have to use blabla's additions though.
– Alberto L. Bonfiglio
Apr 3 at 22:31
add a comment |
up vote
11
down vote
In addition to the answer of @quixotic:
Make sure you have in /etc/NetworkManager/NetworkManager.conf :
[main]
dns=dnsmasq
if you need to add it, restart NetworkManager like this:
sudo systemctl restart NetworkManager
and /etc/resolv.conf needs to be a symlink to /var/run/NetworkManager/resolv.conf . could be done like this
sudo rm /etc/resolv.conf; sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
 
 
 
 
 
 
 Actually I have it set as- dns=defaultand it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.
 – pbhj
 Jun 10 '17 at 14:56
 
 
 
 
 
 1
 
 
 
 
 This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
 – Roberto Tyley
 Jun 11 '17 at 10:07
 
 
 
add a comment |
up vote
11
down vote
In addition to the answer of @quixotic:
Make sure you have in /etc/NetworkManager/NetworkManager.conf :
[main]
dns=dnsmasq
if you need to add it, restart NetworkManager like this:
sudo systemctl restart NetworkManager
and /etc/resolv.conf needs to be a symlink to /var/run/NetworkManager/resolv.conf . could be done like this
sudo rm /etc/resolv.conf; sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
 
 
 
 
 
 
 Actually I have it set as- dns=defaultand it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.
 – pbhj
 Jun 10 '17 at 14:56
 
 
 
 
 
 1
 
 
 
 
 This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
 – Roberto Tyley
 Jun 11 '17 at 10:07
 
 
 
add a comment |
up vote
11
down vote
up vote
11
down vote
In addition to the answer of @quixotic:
Make sure you have in /etc/NetworkManager/NetworkManager.conf :
[main]
dns=dnsmasq
if you need to add it, restart NetworkManager like this:
sudo systemctl restart NetworkManager
and /etc/resolv.conf needs to be a symlink to /var/run/NetworkManager/resolv.conf . could be done like this
sudo rm /etc/resolv.conf; sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
In addition to the answer of @quixotic:
Make sure you have in /etc/NetworkManager/NetworkManager.conf :
[main]
dns=dnsmasq
if you need to add it, restart NetworkManager like this:
sudo systemctl restart NetworkManager
and /etc/resolv.conf needs to be a symlink to /var/run/NetworkManager/resolv.conf . could be done like this
sudo rm /etc/resolv.conf; sudo ln -s /var/run/NetworkManager/resolv.conf /etc/resolv.conf
edited Aug 21 '17 at 1:39
Kevin Bowen
14.2k145969
14.2k145969
answered May 3 '17 at 12:30
blabla
1112
1112
 
 
 
 
 
 
 Actually I have it set as- dns=defaultand it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.
 – pbhj
 Jun 10 '17 at 14:56
 
 
 
 
 
 1
 
 
 
 
 This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
 – Roberto Tyley
 Jun 11 '17 at 10:07
 
 
 
add a comment |
 
 
 
 
 
 
 Actually I have it set as- dns=defaultand it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.
 – pbhj
 Jun 10 '17 at 14:56
 
 
 
 
 
 1
 
 
 
 
 This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
 – Roberto Tyley
 Jun 11 '17 at 10:07
 
 
 
Actually I have it set as
dns=default and it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.– pbhj
Jun 10 '17 at 14:56
Actually I have it set as
dns=default and it works fine because I have the nameservers defined then by NetworkManager instead of being defined in dnsmasq; this works for me - NM gets the nameservers from the settings made in KDE's NM configuration via the system tray. I use fixed IP on my home network FWIW.– pbhj
Jun 10 '17 at 14:56
1
1
This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
– Roberto Tyley
Jun 11 '17 at 10:07
This step was a necessary addition to @quixotic's answer for me (ubuntu 17.04, full installation, not LiveCD).
– Roberto Tyley
Jun 11 '17 at 10:07
add a comment |
up vote
0
down vote
According to the manual of systemd-resolved, systemd-resolved provides with name resolution services via three different interfaces:
- "fully-featured API systemd-resolved exposes on the bus"
- "a local DNS stub listener on IP address 127.0.0.53 on the local loopback interface"
 - The glibc getaddrinfo(3) API as defined by RFC3493 and its related resolver functions, including gethostbyname(3). This API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC validation status information however, and is synchronous only. This API is backed by the glibc Name Service Switch (nss(5)). Usage of the glibc NSS module nss-resolve(8) is required in order to allow glibc's NSS resolver functions to resolve host names via systemd-resolved. 
 
It seems that the first two interfaces won't interfere in normal DNS resolution and for me the problem is likely to reside on the third.
In the manual of nss-resolve:
To activate the NSS module, add "resolve" to the line starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:" line (but after the "files" or "mymachines" entries), right before the "dns" entry if it exists, followed by "[!UNAVAIL=return]", to ensure DNS queries are always routed via systemd-resolved(8) if it is running, but are routed to nss-dns if this service is not available
So what is needed is to make "dns" precedes "resolve" in "host:" line of /etc/nsswitch.conf. And then getaddrinfo should simply adhere to /etc/resolv.conf .
This solution only prevents systemd-resolved from handling all the DNS resolution requests and is not restricted to a specific network manager. And it also makes sure LLMNR and mDNS service are operating normally.
( I am not fair familiar with how name resolution works under Linux and also unsure about what I understood from these manuals. Pleaes point out if I got something wrong. Thx :) )
add a comment |
up vote
0
down vote
According to the manual of systemd-resolved, systemd-resolved provides with name resolution services via three different interfaces:
- "fully-featured API systemd-resolved exposes on the bus"
- "a local DNS stub listener on IP address 127.0.0.53 on the local loopback interface"
 - The glibc getaddrinfo(3) API as defined by RFC3493 and its related resolver functions, including gethostbyname(3). This API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC validation status information however, and is synchronous only. This API is backed by the glibc Name Service Switch (nss(5)). Usage of the glibc NSS module nss-resolve(8) is required in order to allow glibc's NSS resolver functions to resolve host names via systemd-resolved. 
 
It seems that the first two interfaces won't interfere in normal DNS resolution and for me the problem is likely to reside on the third.
In the manual of nss-resolve:
To activate the NSS module, add "resolve" to the line starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:" line (but after the "files" or "mymachines" entries), right before the "dns" entry if it exists, followed by "[!UNAVAIL=return]", to ensure DNS queries are always routed via systemd-resolved(8) if it is running, but are routed to nss-dns if this service is not available
So what is needed is to make "dns" precedes "resolve" in "host:" line of /etc/nsswitch.conf. And then getaddrinfo should simply adhere to /etc/resolv.conf .
This solution only prevents systemd-resolved from handling all the DNS resolution requests and is not restricted to a specific network manager. And it also makes sure LLMNR and mDNS service are operating normally.
( I am not fair familiar with how name resolution works under Linux and also unsure about what I understood from these manuals. Pleaes point out if I got something wrong. Thx :) )
add a comment |
up vote
0
down vote
up vote
0
down vote
According to the manual of systemd-resolved, systemd-resolved provides with name resolution services via three different interfaces:
- "fully-featured API systemd-resolved exposes on the bus"
- "a local DNS stub listener on IP address 127.0.0.53 on the local loopback interface"
 - The glibc getaddrinfo(3) API as defined by RFC3493 and its related resolver functions, including gethostbyname(3). This API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC validation status information however, and is synchronous only. This API is backed by the glibc Name Service Switch (nss(5)). Usage of the glibc NSS module nss-resolve(8) is required in order to allow glibc's NSS resolver functions to resolve host names via systemd-resolved. 
 
It seems that the first two interfaces won't interfere in normal DNS resolution and for me the problem is likely to reside on the third.
In the manual of nss-resolve:
To activate the NSS module, add "resolve" to the line starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:" line (but after the "files" or "mymachines" entries), right before the "dns" entry if it exists, followed by "[!UNAVAIL=return]", to ensure DNS queries are always routed via systemd-resolved(8) if it is running, but are routed to nss-dns if this service is not available
So what is needed is to make "dns" precedes "resolve" in "host:" line of /etc/nsswitch.conf. And then getaddrinfo should simply adhere to /etc/resolv.conf .
This solution only prevents systemd-resolved from handling all the DNS resolution requests and is not restricted to a specific network manager. And it also makes sure LLMNR and mDNS service are operating normally.
( I am not fair familiar with how name resolution works under Linux and also unsure about what I understood from these manuals. Pleaes point out if I got something wrong. Thx :) )
According to the manual of systemd-resolved, systemd-resolved provides with name resolution services via three different interfaces:
- "fully-featured API systemd-resolved exposes on the bus"
- "a local DNS stub listener on IP address 127.0.0.53 on the local loopback interface"
 - The glibc getaddrinfo(3) API as defined by RFC3493 and its related resolver functions, including gethostbyname(3). This API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC validation status information however, and is synchronous only. This API is backed by the glibc Name Service Switch (nss(5)). Usage of the glibc NSS module nss-resolve(8) is required in order to allow glibc's NSS resolver functions to resolve host names via systemd-resolved. 
 
It seems that the first two interfaces won't interfere in normal DNS resolution and for me the problem is likely to reside on the third.
In the manual of nss-resolve:
To activate the NSS module, add "resolve" to the line starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:" line (but after the "files" or "mymachines" entries), right before the "dns" entry if it exists, followed by "[!UNAVAIL=return]", to ensure DNS queries are always routed via systemd-resolved(8) if it is running, but are routed to nss-dns if this service is not available
So what is needed is to make "dns" precedes "resolve" in "host:" line of /etc/nsswitch.conf. And then getaddrinfo should simply adhere to /etc/resolv.conf .
This solution only prevents systemd-resolved from handling all the DNS resolution requests and is not restricted to a specific network manager. And it also makes sure LLMNR and mDNS service are operating normally.
( I am not fair familiar with how name resolution works under Linux and also unsure about what I understood from these manuals. Pleaes point out if I got something wrong. Thx :) )
answered Nov 29 at 9:17
Dummmy
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f898605%2fhow-to-disable-systemd-resolved-and-resolve-dns-with-dnsmasq%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe this could help : askubuntu.com/questions/1032450/…
– cmak.fr
May 18 at 8:13