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

Unable to bind to 0.0.0.0:53 when systemd-resolved is running #743

Closed
ghost opened this issue Sep 19, 2018 · 10 comments
Closed

Unable to bind to 0.0.0.0:53 when systemd-resolved is running #743

ghost opened this issue Sep 19, 2018 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 19, 2018

This is the same issue as #680, just ran into it again on Ubuntu 18.04. Any example you have that tries to bind to port 53 while systemd-resolved should trigger this.

@ghost
Copy link
Author

ghost commented Sep 19, 2018

@ghost
Copy link
Author

ghost commented Sep 19, 2018

Related: #487

Would be nice to request socket options with this library.

@miekg
Copy link
Owner

miekg commented Sep 19, 2018 via email

@ghost
Copy link
Author

ghost commented Sep 19, 2018

systemd-resolved is bound to 127.0.0.53 port 53 with SO_REUSEADDR. If we have the option to enable SO_REUSEADDR when binding 0.0.0.0 port 53, these two can coexist just fine.

@tmthrgd
Copy link
Collaborator

tmthrgd commented Sep 20, 2018

@teran-mckinney SO_REUSEADDR hasn’t been implemented, while SO_REUSEPORT has been. After some quick reading, what you’re trying to do is valid and exactly what SO_REUSEADDR was designed for. (This is a somewhat verbose explanation: https://stackoverflow.com/a/14388707).

It wouldn’t be a huge amount of work to add, but we would start to get a multitude of socket options hanging off Server.

@ghost
Copy link
Author

ghost commented Sep 20, 2018

Thanks for looking into this. I agree, maybe there's a cleaner way to implement the options but I don't know Go very well.

@miekg
Copy link
Owner

miekg commented Jan 9, 2019

you should make your own conn and use that; not something this lib should provide.

@miekg miekg closed this as completed Jan 9, 2019
@ghost
Copy link
Author

ghost commented Jan 9, 2019

you should make your own conn and use that; not something this lib should provide.

Could you provide an example on how to do that? I've looked through the examples in exdns and can't see any cases where you made the socket and put a DNS server on that socket.

@tmthrgd
Copy link
Collaborator

tmthrgd commented Jan 9, 2019

@teran-mckinney Use the ListenConfig type and it’s methods from the net package to create a connection with the SO_REUSEADDR flag set (see listen_go111.go). Then set either the Listener or PacketConn fields on Server and call ActivateAndServe like you would ListenAndServe.

@ghost
Copy link
Author

ghost commented Jan 10, 2019

@tmthrgd thank you! I appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants