Current best method for local domains?

I have a VM for web development that I have moved from a hyperv instance and I want to know what the current best way to access it is.

I have created the VM via virt-manager and I can see it. Next step is accessing the web sites.

On Windows I had multiple entries in the hosts file of the type centos8.local, website1.local etc

2 questions:

  1. Is it still ok to do something like this? From reading around, it seems mdns uses .local. Will I clash with anything?
  2. With all the recent changes in the networking stack, is my old approach still the best way? I can add the entries manually to /etc/hosts, but with systemd-resolved is there a better way that I should learn?
1 Like

Using .local for private addresses is not a good idea, on Windows or on Linux.

Use another top-level domain, or better yet, leave the machine names unqualified, i.e. centos8.


I found these with a quick google:

So it appears is what is proposed by the rfc.

Regards Tom.

1 Like

Thanks. Is etc/hosts still the correct/best destination?

For very small sized environments such as you describe, /etc/hosts should work fine. This assumes you work in a hub-and-spoke-like configuration, one system on which you use /etc/hosts in the middle, connecting to these additional systems. But for more of a mesh environment, you’ll find maintaining /etc/hosts files on multiple systems to be a nuisance and error prone. I moved from trying to manage /etc/hosts on a handful of systems to using dnsmasq to manage my local server namespace. Now I edit in one place, and through the magic of DNS, all systems know where the new server can be reached. Dnsmasq is installed on a single always-on system which is my local DNS server. Search for articles on dnsmasq for more information when management of your small domain becomes more effort than you find comfortable.

1 Like