Setup Auto DNS
Setup Auto DNS
Use the bundled bind container to resolve every project under your
TLD_SUFFIX. This avoids adding each hostname to /etc/hosts.
How it works
The Devilbox DNS service runs in the dvlbox/bind container and serves
wildcard records for your configured suffix. If .env has
TLD_SUFFIX=loc, names like these resolve automatically:
project.locwww.project.locadmin.project.locThe DNS answer points at the Devilbox web entrypoint on your host.
Configure Devilbox
Edit .env:
nano .envUse a suffix and bind the DNS service to port 53:
TLD_SUFFIX=locLOCAL_LISTEN_ADDR=127.0.0.1:HOST_PORT_BIND=53Start DNS:
./dvl.sh up bindVerify the container is running:
docker compose ps binddocker compose logs --tail=50 bindmacOS resolver
Create a per-suffix resolver file:
sudo mkdir -p /etc/resolverecho "nameserver 127.0.0.1" | sudo tee /etc/resolver/locFlush the cache:
sudo dscacheutil -flushcachesudo killall -HUP mDNSResponderVerify:
scutil --dns | grep -A3 'domain : loc'dig project.loc @127.0.0.1ping -c1 project.locIf you only need one hostname, use the manual hosts-file flow instead: Add project hosts entry on MacOS.
Linux with NetworkManager
Tell NetworkManager to use Devilbox DNS for the suffix:
nmcli connection show --activenmcli connection modify "Wired connection 1" \ +ipv4.dns 127.0.0.1 \ +ipv4.dns-search locnmcli connection up "Wired connection 1"If your connection name differs, replace Wired connection 1 with the
active name from the first command.
Verify:
resolvectl query project.loc || getent hosts project.locLinux with systemd-resolved
Create a dedicated resolved drop-in:
sudo mkdir -p /etc/systemd/resolved.conf.dsudo tee /etc/systemd/resolved.conf.d/devilbox.conf >/dev/null <<'EOF'[Resolve]DNS=127.0.0.1Domains=~locEOFRestart the resolver:
sudo systemctl restart systemd-resolvedVerify:
resolvectl dnsresolvectl domainresolvectl query project.locPort conflicts
If ./dvl.sh up bind fails, another resolver already owns port 53.
Find it:
sudo lsof -nP -iUDP:53 -iTCP:53Stop the conflicting service or keep HOST_PORT_BIND=1053 and query it
manually:
dig project.loc @127.0.0.1 -p 1053Change the suffix
When TLD_SUFFIX changes, update both .env and the operating-system
resolver config.
For macOS, replace the resolver file name:
sudo rm -f /etc/resolver/locecho "nameserver 127.0.0.1" | sudo tee /etc/resolver/testRestart DNS:
./dvl.sh restart bindChecklist
.envhasTLD_SUFFIX=locor your chosen suffix..envhasHOST_PORT_BIND=53for OS resolver integration../dvl.sh up bindstarts successfully.- The host OS sends that suffix to
127.0.0.1. project.<suffix>resolves before opening it in the browser.