Synology DiskStation as DHCP and DNS Server at Home

I recently decided to take advantage of the Synology DiskStation’s DNS app, for a variety of reasons.  This led me to switch to using the DiskStation for DHCP too, as I find the reservation system on the Netgear router extremely cumbersome†.

There are many articles on the Internet covering aspects of this, but they all seemed to fall short of some critical steps, so I thought I’d try and create an absolute step-by-step guide that covers everything.  So it will be rather verbose!  That said, some familiarity with what DNS is and how it works is a must… if DNS is a complete and utter mystery to you, I don’t recommend reading any further.

By the way, my DiskStation is a DS413, which is rather old, but also should mean that anything I can do, you can also do!

Overall goal

You can of course substitute all of these values for your own, but it’s a good idea to plan this out first

  • Local network: 192.168.1.0/24 (netmask 255.255.255.0)
  • Gateway/Router IP: 192.168.1.1
  • DiskStation IP: 192.168.1.254
  • Local domain name: .private††

When finished, each local network client will:

  1. Be assigned an IP address with DNS Settings resolving first to the Synology, then to your router.  Devices on the “Guest” network will always fall back to the router for DNS resolution (as they won’t be able to see the Synology).
  2. Your router will resolve external addresses as normal, and does not need to be aware of the Synology DNS or DHCP at all.
  3. Your router’s own IP Address and DNS settings must remain as they were (ideally, getting whatever your ISP provides.

DHCP

The DiskStation comes with a DHCP server as part of the standard OS; you will find it under Control Panel.

Give your Synology DiskStation a static address.

This is really important; you’re setting the DiskStation as a critical server on your network.  In fact the DHCP app warns you if you try to set up DHCP without first doing this.

I chose 192.168.1.254 because I already had something assigned to 192.168.1.2… and, it was late at night, and I wanted to make this transition as easy as possible!

  1. Go to Control Panel > Network > Network Interface
  2. Select LAN and then “Edit”
  3. Configure as below
    Synology Network Configuration

Save this and your DiskStation will reboot.  It should also populate your browser URL with the new address.  Once you’re back into the DiskStation OS, you’re ready to continue.

Configure DHCP

This part is very simple, particularly if you’ve used your router’s DHCP reservation system.

  1. Make a note of all the DHCP reservations on your router (on the Netgear, you can just drag-select on the relevant page and then paste into a text file.
  2. On the DiskStation, go to Control Panel > DHCP Server
  3. Highlight the “LAN” entry and then click “Edit”Now the unfortunately part… you can’t add reservations unless you enable DHCP… which then will clash with your router’s assignments.  So you need to turn off your router’s DHCP… and turn on the DiskStation DHCP before you have any reservations… which means some devices will start grabbing addresses.  Ok, it’s a bit of a mess, but we can minimise the damage by temporarily setting a very short lease time.
  4. Disable DHCP on your router.  On my Netgear Nighthawk, this fortunately does not clear the list of reservations, so I will still have them as a reference.
  5. Select “Enable DHCP Server” and then configure as below, particularly making sure to set the least time very short (in the example below, I’ve set it to 60 seconds).
    Synology DHCP Server Config.png
  6. Now add a subnet list.  This is the start/end range for clients that will not have a reservation.
    DHCP Subnet Range
    The actual range is entirely up to you; what I have done is give plenty of room for the (too) many Internet-enabled devices I have in my house to have reserved addresses, so I have the range starting at .100.  And, because my DiskStation has a static address of .254, I stop one before that.Also remember that the Domain name is the one you will use in the DNS Section.
  7. Click OK to save, and then go back in and select the DHCP Clients tab.
  8. Start replicating the reservations from your router.  There are two options here:
    1. Create new entries, ignoring whatever is showing up already in the list
    2. Edit the entries in the list, one by one, changing their IP address (and hostname if necessary) to match what you had in your router.I found it easier to ignore existing entries and simple add new ones, systematically.

Adding a DHCP Client.png

You may see some entries have a red warning triangle, indicating that the device currently has a different IP address checked out – don’t worry!  Because the lease time is only 1 minute, it should sort itself out soon enough.

Also note that although the 3rd field says “hostname” and doesn’t allow spaces… it’s really just a label, and doesn’t tie in with DNS hostnames.

Leave everything to settle down for a while, and check that the red warning triangles have gone away before setting the lease time to a more sensible value, such as 3600 seconds.  You can refresh the view periodically to check this.

DNS

  1. Open up Package Center and search for the DNS app; then install it
  2. Open the DNS Server app
  3. Create a new Master Zone
    Zone Selector
  4. Configure it as a Forward Zone and click “OK” to save (which takes you back to the Zones page).
    Master Forward Zone
  5. From the Zones page, double-click to select the zone you just created, and you can now start adding records.  These are primarily going to be “A Records”, which allow you to look up an IP address from a host name.
    Forward Record SelectorAdd A Record
  6. Create another new Master Zone and configure is as a Reverse Zone as follows, bearing in mind that the domain name is the first 3 octets of your IP address, in reverse (so 192.168.1 becomes 1.168.192).
    Master Reverse Zone
    If you ever want to change your domain name, you don’t need to create a new Reverse Zone (however, you will need to change its entries).
  7. For some reason, the main default entries are not created for Reverse Zones (like they are for Forward Zones), so you will need to manually create the following:
    1. A default NS record (leaving the first field empty)
      Default NS Record
    2. A PTR Record, pointing to your DiskStation’s IP address
      Default PTR Record
  8. After that, you should create a PTR Record in the Reverse Zone for every A Record in the Forward Zone.  Best practice is to put the full hostname with domain name, as in this example (which corresponds to the A Record above in Step 5.):
    Example PTR Record

Final Checks

And now you’re done!  To be able to use your new DNS to lookup local addresses from the command line, you need to wait until that computer picks up the changes via DHCP (or force it by running a release/renew).  On Unix-like computers using DHCP, you can look at the file /etc/resolv.conf to see when the new settings have been propagated:

Now you should be able to resolve up local hostnames and IP addresses with nslookup and/or dig.

 

Footnotes

† You can’t re-order the list of reservations (e.g. by IP address); clients that already have reservations show up in the list of potential reservees to be selected – it’s a painful Ux.

††  This is a contentious point… strictly speaking you shouldn’t use made-up names for your TLD.  You should definitely avoid .local, as this will mess around with zero-conf devices.  I chose .private because it’s conveniently short (unlike my registered company domain) and I have no intention of propagating my DNS up to public DNS servers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: