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

generic/debian boxes have fixed DNS servers when used in Vagrant with libvirt #282

Open
ghost opened this issue Sep 13, 2023 · 4 comments
Open

Comments

@ghost
Copy link

ghost commented Sep 13, 2023

The Generic Debian boxes (all major releases 8 through 11) have fixed DNS resolvers instead of using DHCP to get the list of nameserver entries.

I'm using Vagrant 2.3.7 with the libvirt provider. The host machine is running Ubuntu 22.04 on amd64.

After vagrant up the file /etc/network/interfaces looks like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface

# The primary network interface
allow-hotplug eth0
auto lo
iface lo inet loopback
iface eth0 inet dhcp
dns-nameserver 4.2.2.1
dns-nameserver 4.2.2.2
dns-nameserver 208.67.220.220
pre-up sleep 2

and /etc/resolv.conf looks like this:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 4.2.2.1
nameserver 4.2.2.2
nameserver 208.67.220.220

This is the case for all generic/debian* boxes. The other boxes I'm currently using don't have this problem (generic/ubuntu20 and 22, and generic/centos7). With the other boxes the above IP addresses can still be found in the config files, but they seem to get overwritten before the bootstrap process.

Since external DNS servers are blocked in my place of work I can't use these boxes as-is at the moment. (Never mind the privacy implications of pushing third-party DNS resolvers on others.)

As a workaround I have put the following line into my bootstrap script. Replace the search domain and nameserver IP address as needed:

echo "search localdomain" > /etc/resolv.conf; echo "nameserver 192.168.1.1" >> /etc/resolv.conf

It would be nice if you could remove these fixed DNS server addresses.

That said, many thanks for providing all these boxes! They are very useful to me.

@ghost
Copy link
Author

ghost commented Sep 13, 2023

And I just noticed that the workaround is not sufficient if you're trying to use synced folders of type nfs instead of rsync.

The setup process tries to install the necessary NFS client packages but fails because the download servers cannot be resolved. This happens before the bootstrap script gets started.

@ghost
Copy link
Author

ghost commented Sep 15, 2023

Oh, I forgot to add version information. All of the boxes were version 4.2.16, pulled via Vagrantfile.

@ladar
Copy link
Member

ladar commented Sep 17, 2023

It's been awhile since I tried using the DNS servers provided over DHCP. I can recall at least two issues:

Some of the box configs would fail to build because a locallly provided DNS servers might respond with an IPv6 addresses, even though the host/guest didn't support v6. As I recall the Ubuntu installers on Hyper-V were particularly fragile.

The second issue was some of the unit tests I run on the Magma version of the boxes require a DNS server to be conformant when handling specific scenarios, like a domain name being invalid. And sometimes DNS servers would violate these rules. For example a consumer ISP might redirect any invalid DNS names to its own servers. This caused spurious test failures.

All that being said, I've slowly been migrating newer box configs over to only using the hardcoded servers as a fall back. If I haven't already, we can try updating the Debian 11/12 configs to start with and see what breaks.

@ekohl
Copy link

ekohl commented Jan 26, 2024

Isn't this a duplicate of #54?

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

No branches or pull requests

2 participants