Setting up a “split DNS” configuration on a Synology NAS for hosting websites
A Quick Primer on DNS
Here’s a very quick primer on the Domain Name System (DNS), a giant database distributed over millions of computers across the globe. It’s primary job is to “resolve,” or look up, the IP address for a given human-readable internet address. For example, the “google.com” address meant for humans resolves to the IP address of “126.96.36.199,” the number that computers use to “dial” google’s website up. This makes the internet much more convenient to use. Typing in long and not very memorable IP addresses is much more of a hassle than typing in an address made up of common letters and words.
The DNS system is quite ingenious. Rather than one organization maintaining and updating a centralized database of all IP addresses and their associates names, it is the responsibility of the owners of each domain to create and update a “zone record” for the domains they have ownership of. For a few bucks a year, you can purchase your own domain and manage your own zone records which let the rest of the world know the IP addresses of the computers associated with your domain. Of course, you also need to pay someone to use an IP addresses provisioned to you and be sure that the computers attached to these IP addresses respond properly when the IP address is “dialed” by another computer, but that’s a topic for another day.
So when you type in an address to your browser, how does your computer know where to find these zone records? That’s the job of what are called “name servers.” If you’ve ever purchased a domain, you know that the registrar requires you to associate two more name servers with your new domain name. It’s the job of these name servers to tell other computers where to find your zone records. Once your computer knows where to find the zone records for a domain, it will then query that computer for the IP address of the human-readable address it’s looking for. Two name servers are usually required to provide redundancy. So if one of the name servers goes down temporarily, a least one other name server will be around to handle incoming requests.
Usually, registrars will give you free use of their name servers and provide a simple web-based interface for updating your own zone records. This makes things easy. But if you need more control over how DNS requests are handled for your domain, you’ll need to set up and run your own name servers so you can handle the requests yourself. To do that, you just have to provide the registrar with the names of the custom name servers that you wish to use.
Hosting your own websites from your own home network, as I do, is one scenario where it’s probably a good idea to run your own name servers and manage your own zone records for you domain. In my case, after getting my website, https://steve.dondley.com, set up on my local network, I noticed that though I could reach my websites from outside my network, computers on my local network at home could could not pull up my website.
Not being familiar with this problem, I googled around and determined I had to set up what’s called a split DNS configuration. I won’t go into all the gory details here. I’m not enough of an expert on DNS to do that. But if you are interested as to what split DNS is and why it’s needed in this case, check out this excellent explanation.
The solution I implemented, outlined below, is specific to the Synology NAS device I have set up on my home network. More specifically, I have model DS1511+ running DSM version 6.2.1-23824, Update 6 with the “DNS Server” package installed. I should also note that the solution below is specific to my situation where I have name server being hosted servers outside of my local network.
Finally, a word of caution: I am not familiar with DNS or Synology’s solution that it calls “Views” to say if the instructions below are optimal. Though the solution works for me, I may be overcomplicating things. You should consult with the official, built-in “DSM Help” documetnation (under “Packages -> “DNS Server” -> “Views”) or your friendly DNS expert to see if this solution can be improved upon:
- On the nameserver, create a zone record for subdomain.myowndomain.com if it doesn’t already exist
- Set up slave zone record for myowndomain.com on synology and fetch records from master zone record
- Set up a master zone record for myowndomain.com on synology using the interface under “Zone” in synology’s DNS server software
- Add a subdomain.myowndomain.com to the new master zone record. The IP address is the internal address of your synology device.
- Go down to the “Views” tab in synology’s DNS server software.
- Create a new view called “internal” (name is arbitrary)
- Set up the forwarders
- Under “select zone,” select the “slave” zone then save the view
- Create a second view called “external”
- set up forwarders
- Under “select zone”, select the “master” zone and save the view
- Make sure internal is listed first and then the external view. If change the order with the “up/down” buttons.