aaronjb Posted May 13, 2009 Share Posted May 13, 2009 So I did a quick search for dnsmasq here and found nothing, which shocked and awed me.. well, ok, I found it a little surprising First, a little background in case you're unaware what dnsmasq is: It's a small-footprint DHCP server and DNS server for use on relatively small networks, and allows you to very quickly set up a machine to both serve out IP addresses to clients via DHCP, and provide DNS name lookups for those same machines as well as forwarding non-local lookups to your ISPs (or any!) DNS servers for resolution. As an example of where it can be useful: I used to use a DSL router that allowed me to configure DHCP clients (my laptop, Mac Mini, unRAID server) with hostnames and would let me do lookups for those same machines - so whatever IP my unRAID box got, it was always accessible via the name 'oracle', my Mini was always available at 'tank' and my MacBook always 'link' (can you guess where the names are from? ) I switched to a fancy-dancyer router which lacked that feature - annoyingly - so I decided to have a changearound and have my unRAID box with a static IP, and have it serve DHCP addresses to the clients on my LAN, and do name lookups as well. Now for the HowTo part - it's quite straightforward really: 1. You'll need to configure a static IP address for your unRAID box if you're currently using DHCP, so do this now via the web interface and save your settings. 2. Connect via telnet to your unRAID server on it's new IP address and download dnsmasq - I store my packages in '/boot/packages/', my instructions assume you do, too: cd /boot/packages wget http://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/slackware-12.1/slackware/n/dnsmasq-2.41-i486-1.tgz 3. Make a 'dnsmasq' directory so we can make the configuration 'stick' across reboots mkdir /boot/packages/dnsmasq 4. Install dnsmasq: installpkg /boot/packages/dnsmasq-2.41-i486-1.tgz 5. Configure dnsmasq - you're going to need to work out what options suit you best, but here's an example of my /etc/dnsmasq.conf file: domain-needed bogus-priv local=/lan/ expand-hosts domain=lan dhcp-range=192.168.1.10,192.168.1.100,255.255.255.0,72h dhcp-option=option:router,192.168.1.254 dhcp-option=option:domain-search,lan dhcp-leasefile=/boot/packages/dnsmasq/dnsmasq.leases dhcp-authoritative local-ttl=60 I highly recommend you read through the default /etc/dnsmasq.conf file yourself and work out what options you want or need - every available option is included in the file with comments explaining what they all do. If you're in a pinch, the above will get you a reasonable config that assumes an IP range of '192.168.1.0' for your machines. One thing that is important to note is the following line: dhcp-leasefile=/boot/packages/dnsmasq/dnsmasq.leases That will make our dhcp leases survive across reboots - it's not mandatory, but it's nice to do. However, if not burning out the write cycles of your USB stick is important, don't do it.. it'll work fine trashing the DHCP leases on reboot, really 6. Copy the dnsmasq.conf somewhere it will survive a reboot: cp /etc/dnsmasq.conf /boot/packages/dnsmasq 7. You'll need to edit your /etc/hosts file so that you don't get an invalid lookup for your unRAID server name (there's a neater way of doing this, actually, but this is quick & dirty) - since the file is generated at boot you'll also need to overwrite it on each boot, so edit your hosts file so it looks like this: # Generated 127.0.0.1 localhost 192.168.1.1 oracle Replace 192.168.1.1 with your actual server IP address - what you've done is moved the server name ('oracle' in my case) from 127.0.0.1 to it's real IP address. Now back that file up: cp /etc/hosts /boot/packages/dnsmasq 8. Now add the following lines to your /boot/config/go file (or /boot/config/go2 for you BubbaRAID folks): ## load dnsmasq here installpkg /boot/packages/dnsmasq-2.41-i486-1.tgz cp /boot/packages/dnsmasq/dnsmasq.conf /etc cp /boot/packages/dnsmasq/hosts /etc /usr/sbin/dnsmasq 9. Now start dnsmasq - you only need to do this now because you've not rebooted yet: /usr/sbin/dnsmasq If you need to debug anything, watch /var/log/syslog: tail -f /var/log/syslog And you're good to go! Local LAN clients will get their IP via DHCP on the unRAID box, and will be able to perform name lookups for anything on the lan, and DNS lookups for remote hosts will be forwarded to whatever you have listed in /etc/resolv.conf (configured via the unRAID GUI - most likely your router or ISP DNS servers). If nobody reports any problems with the above, I'll add it to the Wiki Quote Link to comment
hgeorges Posted February 10, 2010 Share Posted February 10, 2010 Hello; I was researching how to add DNS services to the unraid server, and found your posting. I'm hoping this is now time tested - and working? Now... Can the unraid server provide WINS services as well? I have acouple of notebooks on my private lan, and was hoping to connect to one another via their names. Is that feasible? Thanks for your advice. HG Quote Link to comment
dalben Posted August 26, 2011 Share Posted August 26, 2011 Is this the only solution to getting a DHCP/DNS server running on an unRaid box ? If so, are the instructions still valid ? I'm a noob at linux so if I screw something up I'm not confident that I can back out gracefully. Quote Link to comment
Ford Prefect Posted August 27, 2011 Share Posted August 27, 2011 Is this the only solution to getting a DHCP/DNS server running on an unRaid box ? If so, are the instructions still valid ? I'm a noob at linux so if I screw something up I'm not confident that I can back out gracefully. it would depend on the unraid version you are running and where to find the matching slackware package. Besides from that, the instructions should work, I think. dnsmasq is very flexible and easy to use...lots of help/guides around..use your google foo. If you are unhappy with editing a file under linux and are in need a of gui driven tool, than dnsmasq is not for you. Quote Link to comment
dalben Posted August 28, 2011 Share Posted August 28, 2011 Ideally I was looking for a packages or plugin that would let me unraid server become the DNS and DHCP server for my home LAN, all with a nice web based GUI front end. But I don't see anything like that so it looks like I will have to start learning my way around linux and cli to get what I am after. Quote Link to comment
Ford Prefect Posted August 28, 2011 Share Posted August 28, 2011 dnsmasq is the simplest solution for DHCP and DNS in a single product. Yes, it lacks a GUI but linux and cli is not a must. dnsmasq is configured via a single file. You can edit it on your windows pc and transfer is back to unraid...however win/dos and *nix use different non-printable chars for EOL(EndOfLine) and LF(LineFeed). When on windows, you MUST use an editor that respects this (like notepad++, here: http://notepad-plus-plus.org/) Quote Link to comment
morreale Posted April 3, 2013 Share Posted April 3, 2013 anyone get this working with version 5? i am running unRAID Server 5.0-rc12a AiO and got the latest versions of dnsmasq and libidn but once i try to start everything up i get... dnsmasq: failed to bind DHCP server socket: Address already in use any ideas? does unraid use ports 67 / 68 for anything? sudo netstat -tupln | grep ':53 ' tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 15348/dnsmasq udp 0 0 0.0.0.0:53 0.0.0.0:* 15348/dnsmasq sudo netstat -tupln | grep ':67 ' udp 0 0 0.0.0.0:67 0.0.0.0:* 15348/dnsmasq sudo netstat -tupln | grep ':68 ' no results Quote Link to comment
speeding_ant Posted April 3, 2013 Share Posted April 3, 2013 Check the simpleFeatures DNS server plugin. Easy way to use dnsmasq. Quote Link to comment
BetaQuasi Posted January 22, 2015 Share Posted January 22, 2015 I couldn't find a dnsmasq plugin for unRAID 6 as yet, so I followed the instructions in the first post, substituting with the 64bit Slackware 14.1 package here: http://mirrors.slackware.com/slackware/slackware64-14.1/slackware64/n/dnsmasq-2.57-x86_64-1.txz Worked a treat. Quote Link to comment
HKR Posted February 20, 2015 Share Posted February 20, 2015 Can this work if i am behind a modem serving IP ranges 192.XXX.XXX.XXX and a wifi only router on IP range 10.xx.xx.xx ? All my devices are connected directly or via WIFI on the 10.x.x.x rages. Will need to do port forwarding or anything? Quote Link to comment
BetaQuasi Posted February 20, 2015 Share Posted February 20, 2015 Are there routes between the two subnets? (If you don't know the answer to that, can you ping a device on 192.x from 10.x?). If so, then yes there should be no issue... run up dnsmasq and then change your DHCP servers on both subnets to hand out your unRAID server for DNS (and something else for secondary, eg. 8.8.8.8 for google, or maybe your ISP's DNS server.) Quote Link to comment
HKR Posted February 20, 2015 Share Posted February 20, 2015 Yes, i can ping from my router assigned IP to my modem IP, (pinging from 10.xx.xx.xx to 192.168.1.1 which is modem gateway IP) Is there a benefit of running the DHCP server on the unRAID, like i can use it to access the unRaid server from outside the network? Quote Link to comment
trurl Posted February 20, 2015 Share Posted February 20, 2015 Yes, i can ping from my router assigned IP to my modem IP, (pinging from 10.xx.xx.xx to 192.168.1.1 which is modem gateway IP) Is there a benefit of running the DHCP server on the unRAID, like i can use it to access the unRaid server from outside the network? Not recommended without a VPN. You will be hacked. Quote Link to comment
Recommended Posts
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.