dnsmasq unMenu package - DHCP and DNS


Recommended Posts

Attached to this post is an unMenu package to install the "dnsmasq" service.  This is a very lightweight DHCP and DNS server.  Credit goes to aaronjb who first showed us how to do this here.

 

Why would you want to do this on your unRaid server?  In my case, I have a Netgear WNR2000v3 wireless router.  Like most routers we all have in our home networks, it provides DHCP and appears to provide DNS.  The reality is that it only provides "DNS forwarding" which blindly forwards all DNS requests it receives to the name servers provided by your ISP.  This means that even though it will assign IP addresses to your local machines via DHCP, it won't respond to any DNS requests for those same machine names.  This is not a problem if you only use Windows machines because they will resolve themselves using Netbios.  But trying to resolve your local machine names in an OS that doesn't support Netbios - such as Unix and iOS - will result in disappointment.

 

If your router is supported by Tomato or DD-WRT then you can also solve this by upgrading your router firmware to one of those packages which support full DNS of your local machine names.  But if your router is not supported (like mine) or you don't wish to do that, this is a very simple and low impact way to put those services on your unRaid server.  

 

Installation Instructions:

  • First, make sure your unRaid server is configured to use a static IP address.  It will not be able to use DHCP to get an address from itself since the dnsmasq package won't be installed until after the network initializes.
  • Copy the dnsmasq-unmenu-package.conf into your /boot/packages folder then use the unMenu PkgManager link in the Web GUI to install it and set it to auto start.
    Note: If you have a cache drive in your system, the "config-file-dir" Configuration Variable will default to storing the configuration file on your cache drive in /mnt/cache/.dnsmasq.
    ** If you do NOT have a cache drive, you must change this to be located on your flash drive.  i.e. "/boot".  If you do not do this, your config will be lost on reboot!
     
  • After installation is complete, you will need to edit the dnsmasq.conf file (see above for location) and configure it for your network.  The default dnsmasq.conf file contains all of the available options as well as comments about what each option does but will have all options completely unconfigured.
  • Disable DHCP on your router.  This should immediately cause your clients to request new addresses which should be assigned by dnsmasq on your unRaid server.

 

As an example, these are the options I set in dnsmasq.conf on my server:

 

domain-needed
bogus-priv
local=/local/
dhcp-range=192.168.1.100,192.168.1.150,72h
dhcp-option=option:router,192.168.1.1
dhcp-option=option:dns-server,192.168.1.51,192.168.1.1
dhcp-leasefile=/boot/ConfigFiles/dnsmasq/dnsmasq.leases
dhcp-authoritative
local-ttl=60

 

Please read the comments in dnsmasq.conf for details.  But this config is that is needed to...

 

1. Serve DHCP addresses in the range of 192.168.1.100-150

2. Set the gateway on the clients to 192.168.1.1 (which is my Netgear router with the internet connection)

3. Set the default DNS server on the clients to be my unRaid server (the .50 address) with a backup of my Netgear router

4. Store the lease file on my flash drive so it's persisted on reboots. (I don't have a cache drive installed yet)

 

After making changes to dnsmasq.conf, you can restart it via:

/etc/rc.d/rc.dnsmasq restart

 

This has been tested on unRaid 4.7 and 5.0b14.

 

dnsmasq-unmenu-package.conf

Link to comment
  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.