-
It's a rather specific question but I can't find anywhere else to get help. I am trying to use dnsmasq instead of systemd.resolved on an Ubuntu 21.10 laptop. I have simply disabled systemd.resolved and installed dnsmasq. Originally it was using the default resolvconf but when that didn't work I tried uninstalling resolvconf and installing openresolv instead. However the symptoms are exactly the same. I can see no very obvious errors from either dnsmasq or openresolv/resolvconf in syslog. When started by systemd dnsmasq does complain:- "no servers found in /run/dnsmasq/resolv.conf, will retry". With no changes to default configuration after installing the above I see /etc/resolv.conf is a symbolic link to /run/systemd/resolve/resolv.conf and contains:-
...plus dnsmasq runs with "-r /run/dnsmasq/resolv.conf" and -r /run/dnsmasq/resolv.conf is effectively empty:-
What is needed is to get the upstream server (which is available from DHCP, if systemd.resolved is running then /etc/resolv.conf points to a file which contains the IP of my upstream DNS server) into /run/dnsmasq/resolv.conf. I realise this probably isn't an openresolv issue, it's something to do with how the Ubuntu configuration manages systemd-resolved and dnsmasq (and maybe Network Manager) but I'm having a really hard time finding out how to make it work right so any help you can offer would be very welcome. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Sounds to me like you just need to configure openresolv for your dnsmasq as described in the fine man page resolvconf.conf(5). You can obtain a list of resolv.conf updates from various interfaces/providers by running this command Does this help at all? |
Beta Was this translation helpful? Give feedback.
-
On Mon, Dec 06, 2021 at 03:55:40AM -0800, Roy Marples wrote:
Sounds to me like you just need to configure openresolv for your dnsmasq
as described in the fine man page resolvconf.conf(5).
Yes, I have of course read that, quite a few times! :-)
Or you can read some online docs here: https://roy.marples.name/projects/openresolv/configuration/
Ah, that adds a few extras, thank you.
My /etc/resolvconf.conf is (default as comes with Ubuntu with packages
installed as I have described) :-
# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details
resolv_conf=/etc/resolv.conf
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
#name_servers=127.0.0.1
# Mirror the Debian package defaults for the below resolvers
# so that resolvconf integrates seemlessly.
dnsmasq_resolv=/var/run/dnsmasq/resolv.conf
pdnsd_conf=/etc/pdnsd.conf
unbound_conf=/etc/unbound/unbound.conf.d/resolvconf_resolvers.conf
I have tried uncommenting the name_servers=127.0.0.1 line but that makes
no difference (and anyway I'm getting 127.0.0.1 in /etc/resolv.conf).
You can obtain a list of resolv.conf updates from various interfaces/providers
by running this command `resolvconf -l`.
I think this illustrates the issue:-
chris$ resolvconf -l
# resolv.conf from lo.dnsmasq
nameserver 127.0.0.1
chris$
This suggests that, for whatever reason, the DHCP provided IP isn't
being found when the system is configured the way I have it. I'm using
WiFi (nearly all the time), I might try a wired connection to see if
that changes anything.
Does this help at all?
Just getting an answer is hugely helpful, I have been researching and
asking about this on the Ubuntu lists and the dnsmasq list for several
days and have had no responses at all. I don't think it's because
they're unhelpful or unfriendly it's just that no one knows any
answers.
So thank you for replying and I really would appreciate it if you
could keep in touch with me about this.
What I will try now is uninstalling dnsmasq and re-enabling systemd-resolved
and looking to see what "resolvconf -l" returns then. (Also a wired connection
as noted above).
…--
Chris Green
|
Beta Was this translation helpful? Give feedback.
-
Well, now I'm very confused. I uninstalled dnsmasq and enabled systemd-resolved. I also needed make /etc/resolv.conf a link to /run/systemd/resolve/resolv.conf. This (I think) reverts the system to its default configuration. So, /run/systemd/resolve/resolv.conf now just has "nameserver 192.168.1.2" in it, which is correct, 192.168.1.2 is the DNS and DHCP server for my LAN. However "resolvconf -l" now returns absolutely nothing! How is this working? Ultimately all I want is dnsmasq to run to provide local DNS cacheing and to automatically get the upstream DNS server via DHCP. I need this on this laptop as it does get run in many different places so it has to get its DNS server IP automatically. |
Beta Was this translation helpful? Give feedback.
-
Hmm, I think it's basically not going to work 'out of the box'. If I disable systemd-resolved and install (and run) dnsmasq then /run/dnsmasq/resolv.conf should have the nameserver(s) returned by DHCP in it, but it doesn't. I suspect that if I put dns=dnsmasq in NetworkManager.conf this is supposed to do what I want, but it doesn't (as you say Network Manager is far from perfect). What I have done is as follows:- Leave NetworkManager.conf at default, this means it puts "nameserver 127.0.0.1" in /etc/resolv.conf. Then I have added this one line to /etc/dnsmasq.conf "resolv-file=/run/NetworkManager/no-stub-resolv.conf", this file has the upstream DNS server in it. Fairly simple but not as it should be really! Anyway thanks for replying and helping. |
Beta Was this translation helpful? Give feedback.
Hmm, I think it's basically not going to work 'out of the box'. If I disable systemd-resolved and install (and run) dnsmasq then /run/dnsmasq/resolv.conf should have the nameserver(s) returned by DHCP in it, but it doesn't. I suspect that if I put dns=dnsmasq in NetworkManager.conf this is supposed to do what I want, but it doesn't (as you say Network Manager is far from perfect).
What I have done is as follows:-
Leave NetworkManager.conf at default, this means it puts "nameserver 127.0.0.1" in /etc/resolv.conf. Then I have added this one line to /etc/dnsmasq.conf "resolv-file=/run/NetworkManager/no-stub-resolv.conf", this file has the upstream DNS server in it.
Fairly simple but not as i…