Results 1 to 3 of 3

Thread: [17.04] How to make resolvconf recognise dnsmasq?

  1. #1
    Join Date
    Jun 2016
    Beans
    2,831
    Distro
    Xubuntu

    [17.04] How to make resolvconf recognise dnsmasq?

    I'm trying to get dnsmasq working on Xubuntu 17.04 with NetworkManager. So I have this NetworkManager.conf, which is default except for the dns=dnsmasq line added by me -
    Code:
    $ cat /etc/NetworkManager/NetworkManager.conf
    [main]
    plugins=ifupdown,keyfile
    dns=dnsmasq
    
    [ifupdown]
    managed=false
    Then I disabled systemd-resolved, to make sure it wouldn't be used instead of dnsmasq -
    Code:
    $ sudo systemctl stop systemd-resolved
    $ sudo systemctl disable systemd-resolved
    Removed /etc/systemd/system/multi-user.target.wants/systemd-resolved.service.
    Rebooted for good measure...and I have no DNS. Well, actually, that's not quite accurate, as this works fine -
    Code:
    $ dig @127.0.1.1 noscript.net
    
    ; <<>> DiG 9.10.3-P4-Ubuntu <<>> @127.0.1.1 noscript.net
    ; (1 server found)
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30813
    ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;noscript.net.			IN	A
    
    ;; ANSWER SECTION:
    noscript.net.		76402	IN	A	82.103.134.102
    
    ;; Query time: 7 msec
    ;; SERVER: 127.0.1.1#53(127.0.1.1)
    ;; WHEN: xxxxxxxxxxxxxxxxxxxxxxxx
    ;; MSG SIZE  rcvd: 46
    Where 127.0.1.1 is the IP address on which dnsmasq is listening.

    I think the problem is that /run/resolvconf/resolv.conf does not point to dnsmasq -
    Code:
    $ cat /run/resolvconf/resolv.conf
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    # 127.0.0.53 is the systemd-resolved stub resolver.
    # run "systemd-resolve --status" to see details about the actual nameservers.
    For comparison, this is what that file looks like in 16.04, where DNS with dnsmasq does work -
    Code:
    $ cat /run/resolvconf/resolv.conf
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.1.1
    But I don't know anything about how that file is generated, or what generates it. So I'm not sure where to look next.


    How to get dnsmasq DNS working in 17.04?


    I should mention, there are two reasons I'd like to get this working -
    1) I have a highly customised dnsmasq setup, which I can't afford to lose after upgrading beyond 16.04.
    2) I'm trying to run the 17.04 version of NetworkManager on 16.04. And while the newer NetworkManager compiles and runs fine on 16.04, it gives this same problem there too. So backwards-compatibility in solutions, if possible, would be much appreciated.
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    When your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  2. #2
    Join Date
    Jun 2016
    Beans
    2,831
    Distro
    Xubuntu

    Re: [17.04] How to make resolvconf recognise dnsmasq?

    As it turns out, the problem is that I was approaching this wrong. Instead of trying to look at what sets the DNS servers in the dynamic resolv.conf, I should have worked with what's already in the resolv.conf, and gone from there.

    The answer for 17.04 is not to replace systemd-resolved with dnsmasq. The answer is to chain it with dnsmasq. Edit /etc/systemd/resolved.conf and change the DNS= and FallbackDNS= lines to point to dnsmasq (127.0.1.1). So, if that file was otherwise default, it would now look like this -
    Code:
    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    #
    # Entries in this file show the compile time defaults.
    # You can change settings by editing this file.
    # Defaults can be restored by simply deleting this file.
    #
    # See resolved.conf(5) for details
    
    [Resolve]
    DNS=127.0.1.1
    FallbackDNS=127.0.1.1
    #Domains=
    #LLMNR=yes
    #DNSSEC=no
    #Cache=yes
    #DNSStubListener=udp
    I then rebooted for the change to take effect.

    After this, if all went well, systemd-resolve --status should show only 127.0.1.1 as DNS server.


    Unfortunately, tweaking systemd-resolved doesn't help me on 16.04. However, that doesn't mean there isn't any answer there. Taking another look at the comments in resolv.conf -
    Code:
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    Note the resolvconf(8) - apparently the "(8)" there means I'm supposed to type man 8 resolvconf in a terminal for more info. And with that, and some experimenting, I discovered that it seems to work to put this line in /etc/resolvconf/resolv.conf.d/base -
    Code:
    nameserver 127.0.1.1
    And then run sudo resolvconf -u to apply the change.


    Sorry if I wasted anyone's time with this. I hope the solution is useful.
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    When your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  3. #3
    Join Date
    May 2012
    Location
    Buenos Aires, Argentina
    Beans
    18
    Distro
    Ubuntu

    Re: [17.04] How to make resolvconf recognise dnsmasq?

    I've used this solution to use dnsmasq on my machine. It also fixed connecting to a VPN and the DNS resolution. A similar problem is reported in launchpad https://bugs.launchpad.net/ubuntu/+s...r/+bug/1688018

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •