{"id":262,"date":"2012-07-09T10:00:41","date_gmt":"2012-07-09T15:00:41","guid":{"rendered":"https:\/\/www.foell.org\/justin\/?p=262"},"modified":"2013-01-07T10:00:10","modified_gmt":"2013-01-07T16:00:10","slug":"pimp-your-lan-with-openwrt-and-dnsmasq","status":"publish","type":"post","link":"https:\/\/www.foell.org\/justin\/pimp-your-lan-with-openwrt-and-dnsmasq\/","title":{"rendered":"Pimp your LAN with OpenWrt &#038; Dnsmasq"},"content":{"rendered":"<p>This is part two of a three part series covering Dnsmasq&#8217;s uses regarding:<\/p>\n<ol>\n<li><a title=\"Pimpin\u2019 your dev env with Dnsmasq\" href=\"https:\/\/www.foell.org\/justin\/pimpin-your-dev-env-with-dnsmasq\/\">Local Development DNS<\/a><\/li>\n<li>Local Area Network (LAN) DNS<\/li>\n<li><a title=\"(Re)routing VPN traffic with Dnsmasq\" href=\"https:\/\/www.foell.org\/justin\/rerouting-vpn-traffic-with-dnsmasq\/\">Virtual Private Network (VPN) routing<\/a><\/li>\n<\/ol>\n<p>In my previous post I covered using Dnsmasq locally to bring some organization to local web development.\u00a0 Now I&#8217;d like to cover Dnsmasq&#8217;s use on a Local Area Network (LAN), you don&#8217;t need to be a developer to appreciate Dnsmasq as we kick it up a notch and spread the love across the network.<\/p>\n<p><!--more--><\/p>\n<p>Using Dnsmasq locally is nice and all, but what if you have a home network with multiple computers, each serving different purposes?\u00a0 You probably want them to inter-operate smoothly, and it&#8217;s nice to reference things by name rather than having to remember IP addresses.<\/p>\n<h2>OpenWrt &amp; Dnsmasq<\/h2>\n<p>If you have a computer\/server on your network that is on most of the time, this would be an appropriate candidate to run Dnsmasq on.\u00a0 Or, you can do it my preferred way, which is to buy a wireless router that supports <a title=\"OpenWRT Supported Hardware\" href=\"http:\/\/wiki.openwrt.org\/toh\/start\">OpenWrt (an open-source router firmware)<\/a> &#8211; it includes Dnsmasq.\u00a0 If you decide to use an existing Mac or Unix box on your network to run Dnsmasq, see my <a title=\"Pimpin\u2019 your dev env with Dnsmasq\" href=\"https:\/\/www.foell.org\/justin\/pimpin-your-dev-env-with-dnsmasq\/\">first post regarding Dnsmasq installation and configuration<\/a>, and read the <a title=\"Dnsmasq Manual\" href=\"http:\/\/www.thekelleys.org.uk\/dnsmasq\/docs\/dnsmasq-man.html\">documentation on Dnsmasq&#8217;s DHCP options<\/a>.<\/p>\n<p>For those that go the OpenWrt route, here are some tips on configuring Dnsmasq on OpenWrt Backfire (10.03.1 &#8211; latest stable as of 2012).\u00a0 Once your router has the OpenWrt firmware installed and you&#8217;ve logged into the web interface, navigate to the <em>DHCP and DNS<\/em> tab under <em>Network<\/em>:<\/p>\n<p><a class=\"thickbox\" href=\"https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq.png\" rel=\"gallery-262\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"263\" data-permalink=\"https:\/\/www.foell.org\/justin\/pimp-your-lan-with-openwrt-and-dnsmasq\/openwrt-dnsmasq\/\" data-orig-file=\"https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq.png\" data-orig-size=\"1078,1184\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"openwrt-dnsmasq\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq-932x1024.png\" class=\"alignnone size-large wp-image-263\" title=\"openwrt-dnsmasq\" alt=\"\" src=\"https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq-932x1024.png\" width=\"770\" height=\"846\" srcset=\"https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq-932x1024.png 932w, https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq-273x300.png 273w, https:\/\/www.foell.org\/justin\/files\/2012\/07\/openwrt-dnsmasq.png 1078w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/><\/a><\/p>\n<p>The premise behind Dnsmasq is that it not only includes a DNS Server, it also includes a DHCP server.\u00a0 When DCHP is enabled, Dnsmasq will automagically create a DNS name for each computer that connects to the network, based on it&#8217;s hostname.<\/p>\n<p>The <em>Server Settings<\/em> that determine the\u00a0<a title=\"TLD\" href=\"http:\/\/en.wikipedia.org\/wiki\/TLD\">Top Level Domain (TLD)<\/a> are <em>Local server<\/em> and <em>Local domain<\/em>, set to &#8220;lan&#8221; in my case.\u00a0 Every host that connects will get a &#8220;.lan&#8221; domain name.\u00a0 If you look at the list of <em>Active Leases<\/em> you can imagine each one getting a domain name like lappy64.lan (a play on <a title=\"Strongbad Email 119 (Lappy 486)\" href=\"http:\/\/www.homestarrunner.com\/sbemail119.html\">Strongbad&#8217;s Lappy 486<\/a>), printer.lan, mythtv.lan, etc.\u00a0 In fact, the &#8220;.lan&#8221; extension is not even needed, hosts can be address simply by their hostname &#8211; how easy is that?<\/p>\n<p>For some stubborn devices, which do not report a hostname when asking for an IP address (see those with hostname of &#8220;?&#8221; in the <em>Active Leases<\/em> box), the <em>Static Leases<\/em> section can help out.\u00a0 Once the device is connected, click Add in the <em>Static Leases<\/em> box, then select the device&#8217;s <em>MAC-Address<\/em> from the list.\u00a0 Under <em>Hostname<\/em>, type in the name you&#8217;d like it to be referenced as, such as &#8220;printer.&#8221;\u00a0 Give the device a static IP address (something that&#8217;s not in the DHCP range specified on the\u00a0<em>Network &gt; Interfaces &gt; Lan<\/em> tab &#8211; below .50 is probably safe).\u00a0<em>Save &amp; Apply<\/em> your changes &#8211; you might have to force the device to reconnect in order for it to get the new address.<\/p>\n<p>If you&#8217;ve got computers\/devices that report a hostname just fine but you&#8217;d still like to assign a static IP to, use the <em>Static Leases<\/em> section in the same way, but leave the hostname field blank.<\/p>\n<div class='kindleWidget kindleLight' ><img decoding=\"async\" src=\"https:\/\/www.foell.org\/justin\/wp-content\/plugins\/send-to-kindle\/media\/white-15.png\" \/><span>Send to Kindle<\/span><\/div>","protected":false},"excerpt":{"rendered":"<p>This is part two of a three part series covering Dnsmasq&#8217;s uses regarding: Local Development DNS Local Area Network (LAN) DNS Virtual Private Network (VPN) routing In my previous post I covered using Dnsmasq locally to bring some organization to local web development.\u00a0 Now I&#8217;d like to cover Dnsmasq&#8217;s use on a Local Area Network&hellip; <a href=\"https:\/\/www.foell.org\/justin\/pimp-your-lan-with-openwrt-and-dnsmasq\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1,17],"tags":[23,24],"class_list":["post-262","post","type-post","status-publish","format-standard","hentry","category-business","category-dns","tag-dnsmasq","tag-openwrt"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/posts\/262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/comments?post=262"}],"version-history":[{"count":11,"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/posts\/262\/revisions"}],"predecessor-version":[{"id":647,"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/posts\/262\/revisions\/647"}],"wp:attachment":[{"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/media?parent=262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/categories?post=262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.foell.org\/justin\/wp-json\/wp\/v2\/tags?post=262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}