Building a Private tinydns Server

You’ve outgrown hosts files, so you want to use a DNS server for your LAN only. You won’t be providing any public services. How do you do this with tinydns?

Set up a dnscache server for your LAN. Set up a tinydns server, and enter your internal hosts in /etc/tinydns/root/data.

Using the pixels.net domain to illustrate, the next step is to tell your local dnscache to query your local, private tinydns server for your domain information. Create these files using the IP address of your private tinydns server:

# echo 192.168.1.100 > /service/dnscache/root/servers/pixels.net# echo 192.168.1.100 > /service/dnscache/root/servers/0.168.192.in-addr.arpa

The dnscache user should own these files:

# chown dnscache: /service/dnscache/root/servers/pixels.net# chown dnscache: /service/dnscache/root/servers/0.168.192.in-addr.arpa

Next, restart dnscache:

# svc -t /service/dnscache

dnscache will now consult the local tinydns server for local addresses, and it will consult the /service/dnscache/root/servers/@ file for external addresses.

You can easily do this for multiple domains; just add more domain files to /service/dnscache/root/servers/.

You have to have officially registered domain names for this to work, even if you are not running any public services. If you want the ability to invent whatever domain names you want for your LAN, see this.

Remember that dnscache and tinydns should be on separate machines. Always separate the caching/resolving server from the authoritative server. If you must put them on the same machine, give them separate IP addresses. tinydns can have 127.0.0.1, and dnscache can take the network IP address.