====== What is Dnsmasq ? ====== Dnsmasq provides network infrastructure for small networks: DNS, DHCP, router advertisement and network boot. It is designed to be lightweight and have a small footprint, suitable for resource constrained routers and firewalls. It has also been widely used for tethering on smartphones and portable hotspots, and to support virtual networking in virtualisation frameworks. Supported platforms include Linux (with glibc and uclibc), Android, *BSD, and Mac OS X. Dnsmasq is included in most Linux distributions and the ports systems of FreeBSD, OpenBSD and NetBSD. Dnsmasq provides full IPv6 support. More information at the [[https://thekelleys.org.uk/dnsmasq/doc.html|Dnsmasq web site]] ====== Installing Dnsmasq on TrueNAS ====== 1. Log in to your TrueNAS server as root using SSH or the Shell option of the TrueNAS Web Portal. 2. Make some decisions and define some variables. # Tailor each of these examples for your own situation JAIL_NAME="net" # name of the jail that will contain the instance of dnsmasq 3. Install the software. jexec "ioc-${JAIL_NAME:?}" pkg update jexec "ioc-${JAIL_NAME:?} "pkg install dnsmasq 4. Prepare the dnsmasq configuration file structure. jexec "ioc-${JAIL_NAME:?}" mkdir /usr/local/etc/dnsmasq.d jexec "ioc-${JAIL_NAME:?}" mv /usr/local/etc/dnsmasq.conf /usr/local/etc/dnsmasq.d/1-original.conf jexec "ioc-${JAIL_NAME:?}" touch /usr/local/etc/dnsmasq.d/2-standard.conf jexec "ioc-${JAIL_NAME:?}" touch /usr/local/etc/dnsmasq.d/3-generated.conf jexec "ioc-${JAIL_NAME:?}" touch /usr/local/etc/dnsmasq.d/4-bespoke.conf jexec "ioc-${JAIL_NAME:?}" rm /usr/local/etc/dnsmasq.conf.sample 5. Configure dnsmasq to use this file structure. jexec "ioc-${JAIL_NAME:?}" /bin/sh -c \ "cat >| /usr/local/etc/dnsmasq.conf" \ < ====== Configure Dnsmasq ====== 1. Configure the "standard" options common to most installations. jexec "ioc-${JAIL_NAME:?}" /bin/sh -c \ "cat >| /usr/local/etc/dnsmasq.d/2-standard.conf" \ < 2. Configure the "bespoke" options specific to your needs. jexec "ioc-${JAIL_NAME:?}" /bin/sh -c \ "cat >| /usr/local/etc/dnsmasq.d/4-bespoke.conf" \ < 3. The "generated" options are created by an tool I am currently developing. More information coming soon. ====== Starting the Dnsmasq service ====== Start the Dnsmasq server now, and also when the jail boots up. jexec "ioc-${JAIL_NAME:?}" sysrc dnsmasq_enable="YES" jexec "ioc-${JAIL_NAME:?}" service dnsmasq start