QNAP custom dhcpd config file

In some network I wanted to use QNAP nas (QTS 4.3.4 x64) also as DHCP server, but with my own config file. I needed static bindings and special config with cookie for Smart-UPS RT 10000 XL (which I already mentioned here).
First option was to use some App from AppCenter like DNSMasq (not seen that app? 🙂 You can use alternative repo like https://www.qnapclub.eu/pl/repo/xml – maybe I’ll write something more about that some day), but in my case the default volume is encrypted. As long as I don’t enter password manually after restart or a power failure apps won’t get loaded, so network is dead without DHCP server.
Some solution is to make special not encrypted volume only with that app – but unfortunately most apps does not support volume migration (some other time I will write something more about how to enable this option).
The third solution is to use system dhcp server which is ISC DHCP. It is loaded even when main volume is not mounted. But how to provide custom config premanently?

First of all we need to enable dhcp server in Network & Virtual switch app. In my case br0 interface was used. I propose to configure as small IP range as possible in case if some client succeed to connect before we replace config (just one IP would be fine). Then we put our config file in


For my UPS it was something like:

ddns-update-style none;
get-lease-hostnames true;
default-lease-time 7200;                                                                                                                                                     
max-lease-time 7200;
log-facility local7;
ping-check false;
option apc-token code 43 = string;

subnet netmask {
    option domain-name "domain.org";
    option domain-name-servers,;
    option routers;
    option subnet-mask;
    option broadcast-address;

#some static host
host hsot1 {
   hardware ethernet 04:14:a6:c9:66:78;

#Smart-UPS RT 10000 XL  with AP9619 card 
host ups {
   hardware ethernet 00:ca:a7:62:37:64;
   #cookie needed to get things work
   option apc-token 01:04:31:41:50:43;

Then we create




/bin/grep -q custom_config /etc/dhcpd_br0.conf || \
    ( cp -f /etc/config/dhcpd_br0.conf /etc/dhcpd_br0.conf && \
    kill `cat /mnt/ext/opt/netmgr/api/core/dhcpdLink/br0.pid` )

That script checks if the current config file is ours. If not it replaces the file and kills dhcpd server. QTS has some kind of watchdog mechanism so we don’t need to bother to start it again (ISC DHCP does not support config reload with signals so more elegant way is not possible 🙁 ). Please remember to set correct permissions by

chmod 700 /etc/config/dhcpd_check

Last thing to do is to add our script to cron by editing


and adding

* * * * * /etc/config/./dhcpd_check

Not very elegant solution, but works 🙂