0

dd-wrt and Tomato use dnsmasq to allow easily adding manual DNS entries for reserved DHCP addresses. This is useful for adding names for devices with static IP addresses that don't use DHCP (e.g. a cable modem or the router itself) and for allowing a device to be addressable by multiple names (e.g. nas, synology-nas, ds220plus).

Synology's SRM also uses dnsmasq but doesn't provide equivalent UI. Hostnames can be set via Network Center > Local Network > DHCP Reservation, but hostnames assigned there won't take effect until the device requests a DHCP address, so it is ineffective for devices that don't use DHCP. It also allows assigning only one hostname.

Is there a way that I can add manual DNS entries?

1 Answer 1

1
  1. Enable ssh access to the Synology router. (Control Panel > Services > System Services, check the "Enable SSH service" checkbox.)
  2. ssh into the Synology router. You will need to sign in as root with your administrator password.
  3. Create and edit a file named /etc/dhcpd/static-hosts. (The specific filename doesn't matter.) You then can add IP address and hostname assignments in the same format as /etc/hosts. For example:
    192.168.100.1 cablemodem modem
    192.168.1.1 router
    192.168.1.100 nas synology-nas ds220plus
    
  4. Create and edit a file named /etc/dhcpd/dhcpd-dns-user.conf. (The specific filename does not really matter, but it must be of the form /etc/dhcpd/dhcpd-*.conf.) The file should contain:
    addn-hosts=/etc/dhcpd/static-hosts
    
    where addn-hosts specifies the path to the file you created in step 2. See the dnsmasq.conf.example for other configuration options. In mine, I have:
    local=/lan/
    domain=lan
    no-hosts
    expand-hosts
    addn-hosts=/etc/dhcpd/static-hosts
    
    so that nas and nas.lan resolve to the same thing.
  5. Create and edit a file named /etc/dhcpd/dhcpd-dns-user.info. (The filename should correspond to the filename used in step 3.) The file should contain:
    enable="yes"
    
    You also can just copy one of the existing .info files (e.g. cp /etc/dhcpd/dhcpd.info /etc/dhcpd/dhcpd-dns-user.info).
  6. Restart DHCP by running: /etc/rc.network nat-restart-dhcp. (You might need to flush DNS caches in clients to pick up changes.)

There are other approaches, but an advantage of this one is that it does not modify any existing files and therefore is less likely to be overwritten by system updates. (But even then, it might be prudent to keep a backup on USB storage.)


Most of this is taken from https://community.synology.com/enu/forum/17/post/102810. I'm copying it here because:

  • I don't have confidence that that forum thread will always be available.
  • The forum thread is contains a lot of posts and therefore requires a lot of reading to follow and digest.
  • The posts in the forum thread are not properly formatted (which I suspect is from data migration from Synology's old forums to their new forums), making them hard to read and understand.
  • The forum thread is locked and does not allow updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.