<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>how to configure dnsmasq on Ubuntu 18.04 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/how-to-configure-dnsmasq-on-ubuntu-18-04/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Mon, 06 Jan 2020 14:28:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How To Install &#038; configure Dnsmasq on Ubuntu 18.04 LTS</title>
		<link>https://www.osradar.com/how-to-install-configure-dnsmasq-on-ubuntu-18-04-lts/</link>
					<comments>https://www.osradar.com/how-to-install-configure-dnsmasq-on-ubuntu-18-04-lts/#respond</comments>
		
		<dc:creator><![CDATA[sabi]]></dc:creator>
		<pubDate>Mon, 06 Jan 2020 14:28:25 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Dnsmasq on Linux]]></category>
		<category><![CDATA[how to configure dnsmasq on Ubuntu 18.04]]></category>
		<category><![CDATA[how to install dnsmasq on Ubuntu 18.04]]></category>
		<category><![CDATA[ubuntu 18.04]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=17421</guid>

					<description><![CDATA[<p>Today we are going to Install &#38; configure Dnsmasq DNS Server on Ubuntu 18.04 LTS. Dnsmasq is a simple, lightweight, easy to use &#38; manage DNS server along with support for Lua scripting, IPv6, DNSSEC etc. It has a small footprint hence, suitable for resource-constrained routers &#38; firewalls. Dnsmasq has been designed to provide DNS, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-configure-dnsmasq-on-ubuntu-18-04-lts/">How To Install &amp; configure Dnsmasq on Ubuntu 18.04 LTS</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Today we are going to Install &amp; configure Dnsmasq DNS Server on Ubuntu 18.04 LTS. Dnsmasq is a simple, lightweight, easy to use &amp; manage DNS server along with support for Lua scripting, IPv6, DNSSEC etc. It has a small footprint hence, suitable for resource-constrained routers &amp; firewalls.</p>



<p>Dnsmasq has been designed to provide DNS, and optionally DHCP/TFTP services for a small to mid-size networks. Fist of all we will look at Dnsmasq subsystems &amp; then move toward the Installation.</p>



<p>Dnsmasq has three main subsystems.</p>



<ul><li><strong>DNS subsystem</strong>: Used for caching of A. AAAA,CNAME &amp; PTR.</li><li><strong>DHCP subsystem:</strong> It supports DHCPv4, DHCPv6,BOTP &amp; PXE.</li><li><strong>Router Advertisement:</strong> Provides basic autoconfiguration for IPv6 host.</li></ul>



<h3><strong>Step 1: Installing Dnsmasq on Ubuntu 18.04</strong></h3>



<p>Disable systemd-resolve as it binds to port 53 due to which Dnsmasq will be effected.</p>



<p>Type the given command to disable the resolved service.</p>



<pre class="wp-block-verse">sudo systemctl disable systemd-resolved<br>sudo systemctl stop systemd-resolved</pre>



<p>Also, remove the sysmlinked resolv.conf file by</p>



<pre class="wp-block-verse">$ ls -lh /etc/resolv.conf <br> lrwxrwxrwx 1 root root 39 Aug  8 15:52 /etc/resolv.conf -&gt; ../run/systemd/resolve/stub-resolv.conf<br> $ sudo rm /etc/resolv.conf</pre>



<p>Then create new <strong>resolv.conf</strong> file</p>



<pre class="wp-block-verse">echo "nameserver 8.8.8.8" &gt; /etc/resolv.conf</pre>



<p>As Dnsmasq is available on the apt repository, install it by typing</p>



<p>sudo apt-get install dnsmasq</p>



<p>You can find the main config file for Dnsmasq under /etc/dnsmasq.conf</p>



<pre class="wp-block-verse">sudo nano /etc/dnsmasq.conf</pre>



<p>See the minimal configuration</p>



<pre class="wp-block-verse">Listen on this specific port instead of the standard DNS port<br> (53). Setting this to zero completely disables DNS function,<br> leaving only DHCP and/or TFTP.<br> port=53<br> Never forward plain names (without a dot or domain part)<br> domain-needed<br> Never forward addresses in the non-routed address spaces.<br> bogus-priv<br> By  default,  dnsmasq  will  send queries to any of the upstream<br> servers it knows about and tries to favour servers to are  known<br> to  be  up.  Uncommenting this forces dnsmasq to try each query<br> with  each  server  strictly  in  the  order  they   appear   in<br> /etc/resolv.conf<br> strict-order<br> Set this (and domain: see below) if you want to have a domain<br> automatically added to simple names in a hosts-file.<br> expand-hosts<br> Set the domain for dnsmasq. this is optional, but if it is set, it<br> does the following things.<br> 1) Allows DHCP hosts to have fully qualified domain names, as long<br> as the domain part matches this setting.<br> 2) Sets the "domain" DHCP option thereby potentially setting the<br> domain of all systems configured by DHCP<br> 3) Provides the domain part for "expand-hosts"<br> domain=thekelleys.org.uk<br> domain=mypridomain.com<br> Set Liste address<br> listen-address=127.0.0.1 # Set to Server IP for network responses</pre>



<p>To enable DNSSEC validation &amp; caching, uncomment </p>



<pre class="wp-block-verse">#dnssec</pre>



<p>Do the config according to your own environment &amp; restart dnsmasq services.</p>



<p>sudo systemctl restart dnsmasq</p>



<h3><strong>Step 2: Add DNS records to Dnsmasq</strong></h3>



<p>Add DNS records in the file <strong>/etc/hosts/</strong>. Dnsmasq will reply to queries from clients using these records.</p>



<pre class="wp-block-verse">$ sudo vim /etc/hosts<br> 10.1.3.4 server1.mypridomain.com<br> 10.1.4.4 erp.mypridomain.com <br> 192.168.10.2 checkout.mypridomain.com <br> 192.168.4.3 hello.world</pre>



<p>Then restart dnsmasq services.</p>



<pre class="wp-block-verse">sudo systemctl restart dnsmasq</pre>



<h3><strong>Step 3: Test Dnsmasq functionality </strong></h3>



<p>Edit the file <strong>/etc/network/interfaces</strong> for persistent configuration, or the file <strong>/etc/netplan/</strong> on Ubuntu 18.04 servers. As it is a test, I&#8217;ll modify runtime file <strong>/etc/resolv.conf</strong></p>



<pre class="wp-block-verse">$ sudo nano /etc/resolv.conf<br> nameserver 127.0.0.1<br> nameserver 8.8.8.8</pre>



<p>Then test using dig:</p>



<pre class="wp-block-verse">$ dig A erp.mypridomain.com<br> ; &lt;&lt;&gt;&gt; DiG 9.11.3-1ubuntu1.1-Ubuntu &lt;&lt;&gt;&gt; A erp.mypridomain.com<br> ;; global options: +cmd<br> ;; Got answer:<br> ;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 43392<br> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1<br> ;; OPT PSEUDOSECTION:<br> ; EDNS: version: 0, flags:; udp: 4096<br> ;; QUESTION SECTION:<br> ;erp.mypridomain.com.        IN  A<br> ;; ANSWER SECTION:<br> erp.mypridomain.com.    0   IN  A   10.1.4.4<br> ;; Query time: 0 msec<br> ;; SERVER: 127.0.0.1#53(127.0.0.1)<br> ;; WHEN: Tue Aug 21 10:35:41 UTC 2018<br> ;; MSG SIZE  rcvd: 64</pre>



<p>See the other example </p>



<pre class="wp-block-verse">$ dig checkout.mypridomain.com A +noall +answer<br> ; &lt;&lt;&gt;&gt; DiG 9.11.3-1ubuntu1.1-Ubuntu &lt;&lt;&gt;&gt; checkout.mypridomain.com A +noall +answer<br> ;; global options: +cmd<br> checkout.mypridomain.com. 0 IN A 192.168.10.2</pre>



<p>Confirm that we are getting responses as configured.</p>



<h3><strong>Step 3:Configure Dnsmasq as DHCP Server (Optional)</strong></h3>



<p>Configure <strong>/etc/dnsmasq.conf</strong> &amp; provide DHCP options. You need to provide.</p>



<ul><li>Gateway IP address</li><li>DNS Server IP address</li><li>Network Subnet mask</li><li>DHCP Addresses range</li><li>NTP Server</li></ul>



<p>Look at the example</p>



<pre class="wp-block-verse">dhcp-range=192.168.3.25,192.168.3.50,24h<br> dhcp-option=option:router,192.168.3.1<br> dhcp-option=option:ntp-server,192.168.3.5<br> dhcp-option=option:dns-server,192.168.3.5<br> dhcp-option=option:netmask,255.255.255.0</pre>



<p>Then restart dnsmasq services &amp; configure clients to obtain an IP address from this server.</p>



<pre class="wp-block-verse">sudo systemctl restart dnsmasq</pre>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-configure-dnsmasq-on-ubuntu-18-04-lts/">How To Install &amp; configure Dnsmasq on Ubuntu 18.04 LTS</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-configure-dnsmasq-on-ubuntu-18-04-lts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
