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

problem with reverse resolution and multiple EXTRA_HOSTS #16

Closed
eleaner opened this issue Nov 23, 2018 · 7 comments · Fixed by #36
Closed

problem with reverse resolution and multiple EXTRA_HOSTS #16

eleaner opened this issue Nov 23, 2018 · 7 comments · Fixed by #36
Assignees
Labels
feature Feature Request status:confirmed Issue is confirmed

Comments

@eleaner
Copy link

eleaner commented Nov 23, 2018

following the readme, I try to resolve two hosts like below

docker service create \
  --name bind-dns \
  -p 53:53/tcp \
  -p 53:53/udp \
  -e EXTRA_HOSTS='hetzner1=10.8.0.5=hetzner1,hetzner2=10.8.0.9=hetzner2' \
  cytopia/bind

and I get following log with error error - docker service fails

bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Debug level: 1
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Using default DNS TTL time: 3600 sec
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Using default DNS Refresh time: 1200 sec
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Using default DNS Retry time: 180 sec
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Using default DNS Expiry time: 1209600 sec
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Using default DNS Max Cache time: 10800 sec
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Adding extra host: hetzner1 -> 10.8.0.5 (PTR: hetzner1)
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Adding extra host: hetzner2 -> 10.8.0.9 (PTR: hetzner2)
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] DNSSEC Validation: no
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Adding custom DNS forwarder: 8.8.8.8,8.8.4.4
bind-dns.1.8wkm3glijglg@kimsufi1    | [INFO] Starting BIND 9.11.4
bind-dns.1.8wkm3glijglg@kimsufi1    | /etc/bind/devilbox-extra_hosts.hetzner2.conf:7: zone '0.8.10.in-addr.arpa': already exists previous definition: /etc/bind/devilbox-extra_hosts.hetzner1.conf:7

Everything is working fine with only one specified host.
If I try to define EXTRA_HOST twice, the last one wins

@science695
Copy link

Why are you including the dns name twice? It is intended to be a pair hostname=ipaddress,...

EXTRA_HOSTS=mywebserver.loc=172.16.238.1
https://devilbox.readthedocs.io/en/latest/advanced/add-custom-cname-records.html?highlight=extra%20hosts

and, to match that to your case:

-e EXTRA_HOSTS='hetzner1=10.8.0.5,hetzner2=10.8.0.9'

@eleaner
Copy link
Author

eleaner commented Nov 26, 2018

Please see section 5. Adding reverse DNS:
https://github.com/cytopia/docker-bind#extra_hosts
The following extra host 'my.host' is added and will always point to whatever IP example.org resolves to. As well as adding reverse DNS from 192.168.0.1 to resolve to tld EXTRA_HOSTS='tld=192.168.0.1=tld'

my requirement is to resolve hetzner1 -> 10.8.0.5 as well as 10.8.0.5 -> hetzner1
and it works as long as I have only one entry

@science695
Copy link

science695 commented Nov 26, 2018

Oh, I'm sorry. It looks like the developer added a feature I didn't know about.

I can confirm this bug. I'm going to send some additional information to the developer to help speed this up.

@cytopia: eleaner has found a bug with multiple extra_hosts with reverse lookup.

If you do:
EXTRA_HOSTS=test.loc=172.16.238.42=test.loc,test2.loc=172.16.238.43=test2.loc
(as long as both ip addresses are in the same subnet)

The configuration it creates returns an error:
/etc/bind/devilbox-extra_hosts.test2.loc.conf:7: zone '238.16.172.in-addr.arpa': already exists previous definition: /etc/bind/devilbox-extra_hosts.test.loc:7

This is caused by always adding in a zone for the subnet for every extra host with reverse:
https://github.com/cytopia/docker-bind/blob/master/data/docker-entrypoint.sh#L248

I'm not sure what you were solving by adding that subnet zone, but you might want to track witch subnets you've added a zone and not add duplicate zones.

@cytopia
Copy link
Owner

cytopia commented Dec 8, 2018

Good catch. I will probably have to create multiple zones then

@cytopia cytopia self-assigned this Dec 8, 2018
@dimkasta
Copy link

dimkasta commented Aug 2, 2019

Since this is mostly intended for internal use, adding the reverse zone could be implicit for all cases? Just a thought

@mboehm21
Copy link

Is there already a way to get the reverse-lookup working again?
Is there also a way to round-robin load-balance with this dns-server?

Thanks for creating this really nice image, by the way.

@cytopia cytopia mentioned this issue Mar 16, 2022
2 tasks
@cytopia
Copy link
Owner

cytopia commented Mar 16, 2022

@eleaner @science695 @dimkasta @mboehm21

thanks for the issue. I have made a major rewrite which addresses the fix here: #36

@dvlbot dvlbot added status:confirmed Issue is confirmed feature Feature Request labels Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature Request status:confirmed Issue is confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants