Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS listening address changes from 127.0.0.1 to 0.0.0.0 after startup #2807

Closed
3 tasks done
laggardkernel opened this issue Mar 12, 2021 · 5 comments
Closed
3 tasks done
Assignees
Labels
bug external libs Issues that require changes in external libraries. P2: High research Looking up ways to improve the product in the future.
Milestone

Comments

@laggardkernel
Copy link

laggardkernel commented Mar 12, 2021

Have a question or an idea? Please search it on our forum to make sure it was not yet asked. If you cannot find what you had in mind, please submit it here.

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Issue Details

  • Version of AdGuard Home server:
    • version v0.105.2, channel release, arch darwin amd64
  • How did you install AdGuard Home:
    • Github releases
  • How did you setup DNS configuration:
    • System
  • If it's a router or IoT, please write device model:
    • Macbook
  • CPU architecture:
    • x86_64
  • Operating system and version:
    • macOS 10.14.6

Description

DNS is set to bind on 127.0.0.1 in configuration, but it changes to 0.0.0.0 on specific condition. Seems only UDP listening address is affected.

Related conf

dns:
  bind_host: 127.0.0.1
  port: 53

How to reproduce the bug.

❯ AdGuardHome --version
AdGuard Home, version v0.105.2, channel release, arch darwin amd64

# Clear the DNS set in "System Preferences -> Network",
# change it back to the DNS dispatch by the router
❯ networksetup -setdnsservers "Wi-Fi" empty

# Check the conf file to make sure `bind_host` is set `127.0.0.1`.
# Then start adguard home
❯ sudo AdGuardHome -w /usr/local/etc/adguardhome -s start
2021/03/12 13:19:33 [info] Service control action: start
2021/03/12 13:19:33 [info] Action start has been done successfully on darwin-launchd

~
❯ sudo lsof -i :53
COMMAND     PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
AdGuardHo 77951 root   15u  IPv4 0x75e1237716cbfaa9      0t0  UDP localhost:domain
AdGuardHo 77951 root   22u  IPv4 0x75e1237726b74fc9      0t0  TCP localhost:domain (LISTEN)

# Set 127.0.0.1 as the default DNS on the OS. No different with setting it in "system preferences -> network"
❯ networksetup -setdnsservers "Wi-Fi" 127.0.0.1

# Here's the problem. Listening address is changed dynamically.
❯ sudo lsof -i :53
COMMAND     PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
AdGuardHo 77951 root   15u  IPv4 0x75e1237716cbfaa9      0t0  UDP *:domain  # weird
AdGuardHo 77951 root   22u  IPv4 0x75e1237726b74fc9      0t0  TCP localhost:domain (LISTEN)

# It does serve queries on non loopback interfaces
# 192.168.2.242 is the address assigned on my machine in the Wi-Fi network
❯ dig @192.168.2.242 -p 53 www.google.com

; <<>> DiG 9.16.12 <<>> @192.168.2.242 -p 53 www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55992
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.google.com.                        IN      A

;; ANSWER SECTION:
www.google.com.         87      IN      A       216.58.194.196

;; Query time: 768 msec
;; SERVER: 192.168.2.242#53(192.168.2.242)
;; WHEN: Fri Mar 12 13:39:29 CST 2021
;; MSG SIZE  rcvd: 59

# And only UDP listening address is affected
❯ dig @192.168.2.242 -p 53 +tcp www.google.com
;; Connection to 192.168.2.242#53(192.168.2.242) for www.google.com failed: connection refused.
@ainar-g ainar-g changed the title [Bug Report] DNS listening address changes from 127.0.0.1 to 0.0.0.0 after startup DNS listening address changes from 127.0.0.1 to 0.0.0.0 after startup Mar 12, 2021
@ainar-g ainar-g added the needs investigation Needs to be reproduced reliably. label Mar 12, 2021
@ainar-g
Copy link
Contributor

ainar-g commented Mar 12, 2021

We had a very similar issue recently in #2623, but that one was about Big Sur. We'll investigate, thanks!

@EntropySmoke
Copy link

This may be related (or not). My Raspberry Pi DNS is set to 127.0.0.1 in dhcpd.conf, but AdGuardHome.yaml reports host bind on 0.0.0.0. Is this a correct configuration?

@EugeneOne1 EugeneOne1 added the external libs Issues that require changes in external libraries. label Jun 3, 2021
@EugeneOne1 EugeneOne1 added this to the v0.107.0 milestone Jul 27, 2021
adguard pushed a commit to AdguardTeam/dnsproxy that referenced this issue Aug 3, 2021
Merge in DNS/dnsproxy from 2807-bind-addr to master

Updates AdguardTeam/AdGuardHome#2807.

Squashed commit of the following:

commit 3cfff15
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 17:47:48 2021 +0300

    proxyutil: imp docs

commit 54fbad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 16:59:31 2021 +0300

    proxyutil: fix comments

commit 722a382
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 16:41:05 2021 +0300

    proxyutil: rm oob writing on darwin
adguard pushed a commit that referenced this issue Aug 3, 2021
Merge in DNS/adguard-home from 2807-addr-switch-bug to master

Updates #2807.

Squashed commit of the following:

commit 0340469
Merge: 3ab4d43 5c2ead5
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 19:57:31 2021 +0300

    Merge branch 'master' into 2807-addr-switch-bug

commit 3ab4d43
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 19:21:08 2021 +0300

    all: upd dnsproxy
@EugeneOne1
Copy link
Member

@laggardkernel, latest build was just pushed to the edge channel. Could you please check if it fixes the issue for you?

@EugeneOne1
Copy link
Member

@laggardkernel, we'll close the issue for now. Please, feel free to reopen it if our solution won't fix it for you.

@laggardkernel
Copy link
Author

@EugeneOne1 Yes. Tested with 0.107.0-b.7 and I can confirm the problem resolved. Thanks.

laggardkernel added a commit to laggardkernel/homebrew-tap that referenced this issue Aug 16, 2021
@ainar-g ainar-g added bug P2: High research Looking up ways to improve the product in the future. and removed needs investigation Needs to be reproduced reliably. labels Sep 13, 2021
heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 2807-addr-switch-bug to master

Updates AdguardTeam#2807.

Squashed commit of the following:

commit 0340469
Merge: 3ab4d43 5c2ead5
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 19:57:31 2021 +0300

    Merge branch 'master' into 2807-addr-switch-bug

commit 3ab4d43
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 19:21:08 2021 +0300

    all: upd dnsproxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug external libs Issues that require changes in external libraries. P2: High research Looking up ways to improve the product in the future.
Projects
None yet
Development

No branches or pull requests

4 participants