NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

perrynmyers's avatar
Sep 27, 2020
Status:
New Idea

Support for addn_hosts in dnsmasq on Orbi RBR50

Hi,

Almost all modern routers support local device name resolution using a dnsmasq feature called addn-hosts (or something similar). There seems to be no way to persistently set this feature in the Orbi via the web user interface, however you can temporarily enable it (until a reboot of the router) using the method described here: https://community.netgear.com/t5/Idea-Exchange-For-Home/orbi-add-dns-server/idc-p/1632085#M1731

 

Lack of local DNS support is a serious feature gap in this otherwise excellent home product. And enabling it would be trivial for Netgear. Simply adding an option to the LAN setup page for "Enable Local DNS Resolution" and using that to trigger addition of the following line to /etc/dnsmasq.conf: addn-hosts=/tmp/dhcpd_hostlist This is a one line change to a configuration file, that could be done via a simple web interface option setting.

 

Thanks,

Perry

1 Comment

  • In case anyone is interested in a bit of an extended hack, here's a script that you can use (using the expect utility in Linux) to log into the Orbi and configure dnsmasq programatically. This way when the Orbi reboots, you simply re-run the script.

    It allows both usage of /tmp/dhcpd_hostlist which uses the name each client identifies with (which often can be unset) but it also allows you to put a hosts file on a FAT32 formatted USB stick and put that USB stick into the Orbi Router which on the RBR50 is accessible via /mnt/sda1

     

    Script:

    #!/usr/bin/expect
    
    set addn_hosts "addn-hosts=/mnt/sda1/hosts\naddn-hosts=/tmp/dhcpd_hostlist\n"
    
    set host "192.168.1.1"
    set user "admin"
    set password "********************"
    set timeout 20
    
    spawn telnet $host
    expect "login:" 
    send "$user\n"
    expect "Password:"
    send "$password\n"
    
    send "grep -qF addn-hosts /etc/dnsmasq.conf || (echo \'$addn_hosts\' >> /etc/dnsmasq.conf && echo 'addn-hosts added')\n"
    send "pidof dnsmasq\n"
    send "kill \$(pidof dnsmasq)\n"
    send "/usr/sbin/dnsmasq --except-interface=lo -r /tmp/resolv.conf\n"
    send "pidof dnsmasq\n"

     

    If you don't want to supply a separate hosts file (in the format of ip_addr hostname, with each mapping being a separate line), then you can just remove the addn_hosts=/mnt/sda1/hosts from the addn_hosts variable in the script. This will make it so the only hosts file used is /tmp/dhcpd_hostlist

     

    But if you format a USB drive as FAT32 (or vfat) and put a hosts file on it, you can then arbitrarily configure the Orbi DNS server with whatever local DNS names you want.

     

    Hope this helps someone out.