Skip to content

It is no longer possible to use a dummy interface to configure additional DNS scopes #32022

Closed

Description

@tmccombs

systemd version the issue has been seen with

255

Used distribution

Archlinux

Linux kernel version used

6.8.1-arch1-1

CPU architectures issue was seen on

x86_64

Component

systemd-resolved

Expected behaviour you didn't see

If I configure the name servers for a dummy network interface, with systemd-resolved, then make a DNS request that would resolve using that interface, I would expect it to use the configured nameservers, even if the address should be routed over another interface.

Unexpected behaviour you saw

If I do a DNS resolution on a domain that is configured to go to the dummy inteface, it appears that it instead goes to the default interface for DNS resolution.

Steps to reproduce the problem

Run the following commands:

$ dnsmasq --address=/example.com/127.0.0.1 -p 9596 
$ sudo nmcli connection add con-name dns-test type dummy ifname dummy-dns ipv4.method manual ipv4.addresses 127.0.0.88/32 ipv6.method disable ipv4.dns-search ~example.com ipv4.dns "127.0.0.1#9595"
$ sudo resolvectl dns dummy-dns 127.0.0.1:9596
$ resolvectl query example.com

Observe that it doesn't use the dummy link, and resolves to the real address of example.com instead of localhost, as is served by dnsmasq.

Additional program output to the terminal or log subsystem illustrating the issue

No response

See also:

Note, if #5573 were implemented, then in most cases there wouldn't be a need for this workaround.

Activity

  1. added
    bug 🐛
    on Mar 30, 2024
  2. rpigott commented on Apr 4, 2024

    @rpigott
    Contributor

    I don't suppose this was remedied by #31557?

  3. added
    needs-reporter-feedback ❓
    and removed
    bug 🐛
    on Apr 8, 2024
  4. yrro commented on Aug 21, 2024

    @yrro
    Contributor

    I don't suppose this was remedied by #31557?

    Looks like this is present in v256. I don't understand the remarks about kernel versions, is a particular kernel fix required to test this?

  5. akarl10 commented on Aug 21, 2024

    @akarl10

    I am using v256 and for me the only thing i had to do is adding an ip address to the dummy interface that is scope global for just a moment. after that Current DNS Server showed up

    something like this (replace 1.2.3.4 and privatetld):

    ip l a dns-route type dummy
    ip l s dns-route up
    resolvectl dns dns-route 1.2.3.4
    resolvectl domain dns-route ~privatetld
    resolvectl default-route dns-route false
    #make networkmanager not showing a popup that a new device is up
    nmcli device set dns-route managed no
    #just to make resolvectl take this interface. ::1 does not work, but ::2 should not interfere with something the next 0.2 seconds. not using ipv4 since that might interfere with routing
    ip -6 a a ::2/128 dev dns-route
    sleep 0.2
    ip -6 a d ::2/128 dev dns-route

    a more sophisticated way (a snippet that I use in a script) might be this:

    # DNS Server is the dns server to use
    # DNSDOMAIN is the VPN Domain
    # NLAHost is the hostname that is under DNSDOMAIN but is used for location awareness. May be removed if not needed
        ip l a dns-$DNSDOMAIN type dummy
        ip l s dns-$DNSDOMAIN up
        ip -6 a a fe80::53/64 dev dns-$DNSDOMAIN
        resolvectl dns dns-$DNSDOMAIN [fe80::53]:53535%dns-$DNSDOMAIN
        resolvectl domain dns-$DNSDOMAIN ~$DNSDOMAIN
        resolvectl default-route dns-$DNSDOMAIN false
        nmcli device set dns-$DNSDOMAIN managed no
        dnsmasq --server=/$DNSDOMAIN/$DNSSERVER '--server=/'$NLAHost'/#' --resolv-file=/run/systemd/resolve/resolv.conf --pid-file=/run/dns-$DNSDOMAIN-dnsmasq.pid --port=53535 --listen-address=fe80::53
        #just to make resolvectl take this interface
        ip -6 a a ::2/128 dev dns-$DNSDOMAIN
        sleep 0.2
        ip -6 a d ::2/128 dev dns-$DNSDOMAIN
    

    takedown of the above

        ip l sh dns-$DNSDOMAIN >/dev/null 2>/dev/null && (
            ip l d dns-$DNSDOMAIN
            test -e /run/dns-$DNSDOMAIN-dnsmasq.pid && kill -4 $( cat /run/dns-$DNSDOMAIN-dnsmasq.pid )
        )
  6. tmccombs commented on Aug 29, 2024

    @tmccombs
    ContributorAuthor

    I tried something like the first snippet on systemd 256:

    sudo ip l a dns-route type dummy
    sudo ip l s dns-route up
    sudo resolvectl dns dns-route 127.0.0.2:9053
    sudo resolvectl domain dns-route ~internal
    sudo resolvectl default-route dns-route false
    sudo ip -6 a a ::2/128 dev dns-route
    sleep 0.2
    sudo ip -6 a a ::2/128 dev dns-route

    And in a separate terminal I have

    dnsmasq -p 9053 --listen-address=127.0.0.2 --host-record=test.internal,127.0.0.3 -d

    running.

    but then when I run resolvectl query test.internal, I get back:

    test.internal: Name 'test.internal' not found
    

    Your second snippet has some significant differences from the first one:

    • The dns server is a link-local address bound to the dummy interface, not an address on a different interface
    • It looks like you are running dnsmasq, listening on the dummy interface, to forward queries to the actual dns server

    But I still can't get it to work, and having to run a separate dns resolver to forward to the actual one I want, kind of defeats the purpose of using a dummy interface in order to create a dns scope.

    To be clear, the status does show the server as the "Current DNS Server" but it fails to actually do any lookups.

    I was eventually able to get something working (kind of) if I used dnsmasq listenign directly on the dummy interface as the server, however:

    • Why do I need to use a global scope instead of link scope for it to work?
    • It was remarkably slow. It took over 8 seconds to do a lookup. If I did a query directly to the dummy interface with dig, the response was instantaneous.
  7. akarl10 commented on Aug 29, 2024

    @akarl10

    @tmccombs I use dnsmasq because I need to except some queries from the link zone (x.tld must go to "default" dns butt everything else in .tld must go to the link dns)

    If I would not need that I would use the first one (I tested it with opennic and it worked)
    I don't seem to have dnssec enabled in any form, but that might interfere.
    in theory resolvectl dnssec <interface> false and resolvectl nta <interface> <custom dns domain> should disable this.

    I have not configured any global scope dns server, only link local
    If you refer to ::2/128, for the interface, see https://github.com/systemd/systemd/blob/1e17e48b96bb509754a0a11ea8bd0394965564c6/src/resolve/resolved-link.c#L671C1-L675C42

    A link is relevant for non-multicast traffic if it isn't a loopback device, has a link beat, and has at least one routable address -> this means that links/interfaces that have only fe80::/64 addresses and 127.0.0.1/::1 do not work (if the latter are even assignable to a non lo interface)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-reporter-feedback ❓resolve

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions