Fix container DNS resolution by expanding loopback access control to 127.0.0.0/8#623
Merged
klutchell merged 2 commits intoSep 29, 2025
Merged
Conversation
Owner
|
@copilot we found the root cause already, the fix should be to change the access control line |
Co-authored-by: klutchell <20458272+klutchell@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Unable to resolve hostnames from within containers.
Fix container DNS resolution by expanding loopback access control to 127.0.0.0/8
Sep 29, 2025
Contributor
Author
The fix has been implemented in commit b7dbdd8. Changed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Containers are unable to resolve hostnames when unbound binds to all interfaces (
0.0.0.0:53), but DNS resolution works when binding to a specific IP address like192.168.0.100:53. This affects users running unbound in Docker environments where containers need to perform DNS lookups.Root Cause
The issue occurs because Docker's DNS forwarding mechanism can make container DNS requests appear to originate from various IP addresses within the 127.0.0.0/8 loopback range, not just 127.0.0.1. The current access control rule:
Only allows the specific localhost IP address (127.0.0.1), causing requests from other loopback IPs to be denied by unbound's access control.
Solution
This PR expands the loopback access control from the restrictive
/32(single IP) to/8(entire loopback range):Security Considerations
unbound.conf.exampleTesting
Users can verify the fix by:
-p 53:53/tcp -p 53:53/udpnslookup google.com)Fixes the issue described where containers could only resolve other container names but not external hostnames.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.