Previously, I have configured a proxmox web gui and accessed it using an IP address. However, I realized that using hostnames instead of IP addresses is much more convenient for accessing services in a local network. In this post, I will explain how to configure hostnames in a local network.


I'm using a GLinet router, which is a fork of OpenWRT. The GLinet router has a web interface called Luci, which allows you to configure various settings, including DNS settings. However, I found that the DNS settings in Luci conflict with those in Adguard Home, so I will explain how to set up hostnames using both methods.

Adguard Home

Please make sure your AdGuard Home Handle Client Requests is enabled in GUI. You can also check the configuration file to ensure that Adguard Home is enabled and DNS is set up correctly.

$ cat /etc/config/adguardhome

config adguardhome 'config'
 option enabled '1'
 option dns_enabled '1' # AdGuard Home Handle Client Requests

After that, you can navigate <YOUR_ADGUARD_LOCAL_IP>:3000/#dns_rewrites, then add a domain name and the ip address you needed. After that, you can ping the domain you set up, and it should resolve to the correct IP address. Luci will forward the DNS request to Adguard Home by default, so you don't need to change anything in Luci.

You can check the config.yaml file

$ cat /etc/AdguardHome/config.yaml

# ...
filtering:
  rewrites:
    - domain: "<YOUR_DOMAIN>" # e.g., "proxmox.homelab.local"
      answer: "<YOUR_IP_ADDRESS>"

When setting up your domain, please follow "fully qualified domain name" (FQDN) format, and avoid using format like proxmox.local as it may conflict with mDNS. If you insist on using proxmox.local, you can try "Static Lease" from Luci.

Luci

If you prefer to use Luci, please turn off AdGuard Home Handle Client Requests, then you can navigate to Network -> Hostnames and add a new hostname. However, you need to be careful not to overwrite the DNS settings in Adguard Home. If you do, the hostname will not resolve correctly. Other than that, you need to ensure dnsmasq-dhcpv6 package is installed and it allows you to configure

  • Local server: Change from /lan to /<YOU_DOMAIN>
  • Local domain: Change from lan to <YOUR_DOMAIN>
  • Allow localhost: Check this option to allow localhost to resolve the hostname.

Testing the Configuration

After configuring the hostnames in either Adguard Home or Luci, you need to flush the DNS cache on your devices. For macos, you can run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. After flushing the DNS cache, you should be able to ping the hostnames you set up and access the services using those hostnames.

References