Hi, I’m a Linux user. I use my QNAP NAS with NFS for my Linux PCs and laptops and want to restrict access to NFS for these devices. The long way to do this is allocate static IP addresses and use these in the Shared Folders configuration. However, this is a hassle and what I do with my other servers is use MDNS. Does anyone know how to configure this in QTS?
I see that MDNS works with QTS because I can log in with ssh and use the ava-resolve command:
avahi-resolve --name example.local
I would normally configure nsswitch.conf to include the multicast lookup in the resolution chain:
hosts: files mdns4_minimal [NOTFOUND=return] dns
But QTS overwrites nsswitch.conf (and hosts) on restart. So how should this be done?
QNAP support provided me with a workaround for my mdns question. It’s a clever bash script that uses avahi-resolve to look up the addresses of the hosts that should be allowed access to the NAS and then adds them to /etc/hosts. The ‘example.local’ names in the list can be used in the NFS host access permissions screen just like accessing mdns directly. The script runs via cron every few minutes, replacing the entries to make sure any DHCP changes are accounted for.
This workaround works fine. I would just add that if the workstations have reserved DHCP addresses (like in my situation), then the frequency of the cron update doesn’t need to be high because the addresses rarely change. Also, it’s handy not to have the list of hosts hard-coded in the script but read them from a file. I created an /etc/hosts-mdns file with the list.
Many thanks to QNAP support.