Skip to content

Local IP address reverse lookup is slow when LLMNR=resolve #16243

Closed

Description

@WGH-

systemd version the issue has been seen with
systemd 245 (245)

Used distribution
Gentoo

Expected behaviour you didn't see
Local IP address lookup works fine regardless of LLMNR setting.

Unexpected behaviour you saw
Local IP address lookup takes up to 8 seconds.

$ time host 192.168.0.102
102.0.168.192.in-addr.arpa domain name pointer lenovo-gentoo.
102.0.168.192.in-addr.arpa domain name pointer lenovo-gentoo.local.
host 192.168.0.102  0.00s user 0.01s system 0% cpu 7.682 total

Steps to reproduce the problem

  1. Have LLMNR=resolve and MulticastDNS=resolve in your network config file.
  2. Try to do host 192.168.0.102, where 192.168.0.102 is the configured address of the corresponding interface.

Although doing this might seem like a silly thing to do, systemd-resovled synthesizes DNS records for a local hostname (unless you have an /etc/hosts entry for it), and some programs like to resolve the local hostname to IP address and then resolve the IP address back. Python's socket.getfqdn() does this, and it's hit by this problem pretty hard.

By looking at the traffic, it seems that systemd-resolved attempts to resolve the PTR record using the primary DNS server first, and then tries mDNS protocol, which take some time to time out. Yes, it basically asks others about PTR record for its own IP address.

Since the lookup succeeds even though nobody replies, I guess systemd-resolved already synthesizes PTR records for a local addresses. The problem is it still tries to use mDNS protocol, even though (in theory) it knows that the owner of the IP address in question has LLMNR/mDNS set to "resolve only".

Activity

  1. poettering commented on Jun 23, 2020

    @poettering
    Member

    We generally synthesize records for the local hostname only as fallback if nothing else is defined. i.e. the name in DNS always takes precedence.

    That said, it probably does make sense to skip LLMNR and mDNS for the local hostname, even if we still consult DNS. Right now LLMNR/mDNS/classic DNS come first, local synthesizing last.

  2. WGH- commented on Jun 23, 2020

    @WGH-
    Author

    That said, it probably does make sense to skip LLMNR and mDNS for the local hostname, even if we still consult DNS. Right now LLMNR/mDNS/classic DNS come first, local synthesizing last.

    For some reason, this problem only occurs with reverse lookups. That is, host 192.168.0.102 is slow , but both host lenovo-gentoo and host lenovo-gentoo.local immediately return synthesized records containing IP addresses of all interfaces.

  3. added 3 commits that reference this issue on Feb 15, 2021
    388cc14
    4fd5772
    9aad886
  4. added a commit that references this issue on Feb 16, 2021
    13eb76e
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions