BerlinVagrant / vagrant-dns

A plugin to manage DNS records for vagrant environments
MIT License
490 stars 50 forks source link

Linux support (?) #23

Closed skade closed 1 year ago

skade commented 11 years ago

There is an explanation by @heftig on how to add additional name services in Linux.

https://github.com/code-mancers/invoker/issues/22#issuecomment-25984483

I am not sure whether I like the solution, though. It involves registering a complete new name service with libc, which - in contrast to the OS X variant - potentially impacts the whole system.

proffalken commented 6 years ago

I think it would be better to run the service on port 53 but on a completely different address in the 127.x.x.x/8 range as advised in https://github.com/systemd/systemd/issues/4377

That would then be applicable for all OS's?

heftig commented 6 years ago

Altering /etc/resolver/ on OS X also impacts the whole system. It's really not that different in scope.

A difference is that now your code is getting loaded by the entire system (instead of just your configuration affecting the whole system). If you're concerned about this, you could depend on an existing NSS module like https://github.com/azukiapp/libnss-resolver. The latter implements OS X's scheme on Linux.

The linked bug also mentions dnsmasq which is a poor solution IMO because its impact on system configuration is much greater: Whatever network management the system has must deliver DNS configuration to dnsmasq instead of writing /etc/resolv.conf, which has to be pointed to dnsmasq and dnsmasq only. dnsmasq now proxies all DNS requests.

NSS is designed to be extensible, resolv.conf isn't.

fnordfish commented 6 years ago

vagrant-dns deliberately choose not not listen on port 53 since this would require "sudo" for starting the service (which happens all the time when starting or stopping a box). Other systems than macOS might have a sophisticated way of granting this specific right to a user

mattiasb commented 1 year ago

systemd-resolved supports setting custom ports for dns servers since a while.

mattiasb commented 1 year ago

I made a proof-of-concept for Linux support here.

Got stuck because setting static IP's is a rootful operation with libvirt (I'm using vagrant-libvirt) so I'd need #37 to be fixed as well.

fnordfish commented 1 year ago

Nice! We still have #51 open, which IIRC needed some trigger feature from Vagrant. I'd need to look into that - it's been a while.

However, would you mind opening a PR?

mattiasb commented 1 year ago

@fnordfish absolutely, I just need to get this all working first. I've been struggling trying to get static IPs working with vagrant-libvirt to the point where I managed to break stuff. Once I've confirmed that stuff actually works (and aside from Fedora also Ubuntu) I'll come back to this!

mattiasb commented 1 year ago

Forgot to link back here. But there's a PR since a while: #75 . If anyone could test that it works on Linux that would be great. Especially on other distributions than Fedora and with other providers than libvirt.

mattiasb commented 1 year ago

I think this one can be closed?

fnordfish commented 1 year ago

Closing this one for now. With v2.30, we can now hook into systemd (systemd-resolved), which obviously is not Linux. If anyone likes to see support for a non systemd Linux, please open a new issue. Ideally with an implementation suggestion :)