mirror of
https://github.com/mageddo/dns-proxy-server.git
synced 2026-04-25 09:25:56 +03:00
[GH-ISSUE #580] Bug: systemd-resolved issues #192
Labels
No labels
bug
confirmed
discussion
duplicate
enhancement
feature
feature-request
not-planned
pull-request
secondary-feature
stale
triage
waiting-feedback
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/dns-proxy-server-mageddo#192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ratcashdev on GitHub (Sep 30, 2024).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/580
What is Happening
starting dns-proxy from within a compose file, like:
ping dnsexecuted from the host saysName or service not knownThe logs, in addition contain the entry:
Not possible to restart resolved service: service systemd-resolved restartActually, the command
serviceis not present on my machine. Onlysystemctl restart systemd-resolvedworks.However, even if I restart
resolvedmanually, DNS lookup does not work through dns-proxy.What is Expected
systemd-resolved is restarted and DNS lookup works.
Specs
docker version27.1.2docker run --rm defreitas/dns-proxy-server --version3.25.10-snapshot@mageddo commented on GitHub (Sep 30, 2024):
Hey @ratcashdev , DPS won´t be able to configure itself as the default DNS when running inside a docker container when the host is using system-resolved.
Yep, you will do need to restart systemd-resolved using service or systemctl command, see more details about the limitation.
If you are using DPS as your primary DNS solver I would recommend follow theses steps to configure it as a service and don't have to reconfigure systemd-resolved at every restart.
In alternative you can bypass systemd-resolved and use resolv.conf without the need to restart any service by following these instructions:
@ratcashdev commented on GitHub (Sep 30, 2024):
HI @mageddo thanks for the quick replay and solution.
can you plz elaborate what is the fundamental issue here?
@mageddo commented on GitHub (Sep 30, 2024):
Basically systemd-resolved need to be restarted and it's a host program, a host program can't be executed from the docker container as expected by the isolation principle, DPS is running inside a docker container so it can´t restart the host system-resolved at the host.
@ratcashdev commented on GitHub (Oct 1, 2024):
@mageddo I have tried your suggested setup above. Unfortunately, it seems it still does not work.
here are the logs:
/etc/resolv.confstill stays the same, containingnameserver 127.0.0.53@mageddo commented on GitHub (Oct 1, 2024):
I will do a check, looks like DPS hasn't permission to edit
resolv.conf@ratcashdev commented on GitHub (Oct 1, 2024):
yeah, pretty much:
@mageddo commented on GitHub (Oct 7, 2024):
@ratcashdev
Got it.
/host/etc/resolv.confis a symlinkSo you need to run like below:
Improving the logs to make the failing condition explicit at #585 .
@github-actions[bot] commented on GitHub (Oct 23, 2024):
This issue is stale because it has been waiting-feedback for 15 days with no activity.
@github-actions[bot] commented on GitHub (Oct 31, 2024):
This issue was closed because it has been inactive for 7 days since being marked as stale, you can reopen it at any time.
@ratcashdev commented on GitHub (Oct 31, 2024):
Tested this today. Unfortunately, it still does not work.
Logs look good, but a simple ping to a hostname registered in the compose file fails.
logs:
/etc/resolv.conf (linked to /run/systemd/resolve/stub-resolv.conf) now looks like this:
@mageddo commented on GitHub (Oct 31, 2024):
@ratcashdev can you confirm that DPS is being used as the default DNS? can you see query entries at DPS logs?
If your /etc/resolv.conf keeps with
nameserver 172.18.0.2 # dps-entrythen it's supposed to work.You can ping
dps-sample.devorhost.dockerto check if DPS is working.@ratcashdev commented on GitHub (Oct 31, 2024):
@mageddo unfortunately none of the pings work and I don't see any name queries in the DPS logs.
@mageddo commented on GitHub (Oct 31, 2024):
Looks like systemd-resolved is acting and ignoring resolv.conf. If you really want to run DPS inside docker container you can set an static IP for DPS container and configure it on systemd-resolved as following (you will need to use DPS 3.30.5-snapshot):
Locate the DNS= line in the [Resolve] section and add the container's static IP:
Restart the systemd-resolved service to apply the changes: DPS will be used when available
@ratcashdev commented on GitHub (Nov 11, 2024):
Thanks for the suggestion. My primary use case was to start dns-proxy from inside docker-compose to allow seamless communication between the host and other containers using host names during integration testing. The requirement to restart resolved makes this a non-practical approach (to the extent of being practically unusable) for my use case.
Thanks for your efforts, either way!