Setting up local domains on a LAN using a Synology NAS
Our goal is to access various resources on a LAN using custom domains
such as dsm.homelab.lan (for accessing Synology DSM). We will use a
Synology NAS for this, acting as an authoritative DNS server.
- Install DNS Server on the Synology using Package Center.
Open it and create a primary zone. See the configuration below for
homelab.lan. Simply replace the primary DNS server by your NAS IP.
Figure 1: Configuration for the primary zone.
DNS Server should have created the default records below.
Figure 2: Default records for the zone.
At this point we can already perform a few tests to make sure everything works as intended.
Add the NAS as your primary DNS server on your router. In my case, in the DHCP section of my router:
Figure 3: Adding the NAS as a primary DNS server.
On one of your GNU/Linux machines (for Windows, you're on your own here 😇), refresh your DNS entries.
sudo dhclient -r && sudo dhclient
After this step, you should see your NAS IP in the
resolv.conffile:cat /etc/resolv.conf
You should now be able to ping
ns.homelab.lan, but nothomelab.lan.ping -c 3 ns.homelab.lan && ping -c 3 homelab.lan
> ping -c 3 ns.homelab.lan && ping -c 3 homelab.lan PING ns.homelab.lan (192.168.1.24) 56(84) bytes of data. 64 bytes from 192.168.1.24: icmp_seq=1 ttl=64 time=1.95 ms 64 bytes from 192.168.1.24: icmp_seq=2 ttl=64 time=4.95 ms 64 bytes from 192.168.1.24: icmp_seq=3 ttl=64 time=5.78 ms --- ns.homelab.lan ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2003ms rtt min/avg/max/mdev = 1.949/4.226/5.784/1.646 ms ping: homelab.lan: No address associated with hostname
This is normal. However, you should be able to use the DNS lookup utility
digon both.dig ns.homelab.lan dig homelab.lan
Now let's add a DNS record for Synology DSM at
dsm.homelab.lan. On thehomelab.lanzone, clickEdit > Resource record.
Figure 4: Adding a new record to the zone.
Click
Create > A typeand fill the dialog like this:
Figure 5: Adding a new record to the zone.
Save and finish. You should be able to access DSM in a browser by visiting http://dsm.homelab.lan/1. However, your might see the port in the URL:
Figure 6: Port is still visible in the URL.
To redirect a subdomain (like
dsm.homelab.lan) to an IP + port, we need a reverse proxy. ClickControl Panel > Login Portal > Advanced, and chooseReverse Proxy. Here you can associate a subdomain to a IP + port. In our case:
Figure 7: Adding a reverse proxy entry for Synology DSM.
The port should not appear anymore when you access http://dsm.homelab.lan/.
- You can proceed like this for all your services: Docker containers on the NAS, on a Rasperry Pi, etc., as long as you can already access your resource using a local IP and a port.
Footnotes:
If you simply type dsm.homelab.lan, add a final slash, or the
browser might not try to reach that URL (.lan is not recognized as a
top-level domain).

