Fix DNS redirection when port 53 is already in use #7420
Before posting
Affected areaClient / Agent, DNS Deployment typeNetBird Cloud Operating system or environmentLinux NetBird version and upgrade status0.78.0 Did this work before?No, this never worked Regression detailsNo response SummaryProposal: When Nameservers: 0/0 Available, NetBird should not override the host's DNS configuration. The effective default should be equivalent to disableDns=true until a usable NetBird nameserver is available. Current behaviorWhen NetBird DNS is enabled (disableDns=false), but the peer has no available NetBird nameservers, the client can still configure and use the NetBird DNS resolver. In this situation, netbird status -d reports: Nameservers: 0/0 Available However, DNS queries may still be directed to the NetBird DNS resolver instead of the system's normal DNS configuration. For example: $ dig netbird.io ;; no servers could be reached After disabling NetBird DNS: $ netbird down $ netbird up --disable-dns=true DNS immediately works again through the system resolver: $ dig netbird.io ;; ANSWER SECTION: ;; SERVER: 8.8.8.8#53(8.8.8.8) Expected behaviorIf NetBird reports: Nameservers: 0/0 Available NetBird should not take over the system DNS configuration. The existing system DNS configuration should remain in use until at least one NetBird nameserver becomes available. Steps to reproducewhen Nameservers: 0/0 Available Environment and topologyN/A Self-hosted details, if availableNo response Logs, status output, or debug evidenceN/ARelated issues or discussionsNo response ImpactNo response Additional contextNo response |
Replies: 2 comments 3 replies
|
Your expectation is wrong, NetBird still needs to install its nameserver to resolve peer hostnames. For you specific problem can you provide a debug bundle please? |
|
Thanks for the bundle, it shows what is happening, and the nameserver count is not the cause. Something else on that host already owns port 53, so the client could not bind its resolver on any of the addresses it tries: It then falls back to port 5053 and redirects port 53 to it. That redirect only installed a firewall rule for TCP; UDP was left to an eBPF program attached to the loopback device, and on your host that program is not taking effect. So Two things worth confirming on that host:
On the proposal itself: with no nameserver groups the client still needs its own resolver for peer names, and it forwards everything else to the nameservers that were in resolv.conf before it started. Your bundle shows that part working correctly, it registered 8.8.8.8 as the upstream. Disabling DNS whenever PR: #7439. It installs UDP and TCP rules for the port 53 redirect and drops the eBPF program, which could not work at all on kernels older than 5.7 or when another XDP program is attached to the loopback device. Client builds from that PR are linked here if you would like to try one on the affected host: #7439 (comment) |
Thanks for the bundle, it shows what is happening, and the nameserver count is not the cause.
Something else on that host already owns port 53, so the client could not bind its resolver on any of the addresses it tries:
It then falls back to port 5053 and redirects port 53 to it. That redirect only …