{"id":239,"date":"2018-01-03T10:59:10","date_gmt":"2018-01-03T16:59:10","guid":{"rendered":"http:\/\/zewwy.ca\/?p=239"},"modified":"2019-09-19T21:50:06","modified_gmt":"2019-09-20T02:50:06","slug":"adding-a-static-host-record-to-pihole","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2018\/01\/03\/adding-a-static-host-record-to-pihole\/","title":{"rendered":"Adding a static host record to PiHole"},"content":{"rendered":"<p>Adding a record:<\/p>\n<p>pihole -a hostrecord home.consto.com 192.168.1.10<\/p>\n<p>Removing a record:<\/p>\n<p>pihole -a hostrecord<\/p>\n<p>*UPDATE* This only adds one record, and doing this command a second time removes the old record. For multiple records hosting on a PiHole, here&#8217;s the main deets as provided by llauren:<\/p>\n<p>&#8221;<\/p>\n<p>With a little configuration, you can use your pi-hole as the DNS server for your LAN, if, for example, your router isn\u2019t doing a very good job serving local names. Here\u2019s how:<\/p>\n<p>Create a second dnsmasq configuration file:<\/p>\n<pre><code class=\"hljs bash\">% <span class=\"hljs-built_in\">echo<\/span> <span class=\"hljs-string\">\"addn-hosts=\/etc\/pihole\/lan.list\"<\/span> | sudo tee \/etc\/dnsmasq.d\/02-lan.conf\r\n<\/code><\/pre>\n<p>(that <code>%<\/code> is for whatever your system prompt is; don\u2019t type it out <img decoding=\"async\" class=\"emoji\" title=\":wink:\" src=\"https:\/\/discourse-cdn.pi-hole.net\/images\/emoji\/apple\/wink.png?v=5\" alt=\":wink:\" \/> )<\/p>\n<p>After this, create a \u201chosts file\u201d for your network <code>\/etc\/pihole\/lan.list<\/code> with the format <code>ipaddress fqdn hostname<\/code>, eg<\/p>\n<pre><code class=\"hljs css\">192<span class=\"hljs-selector-class\">.168<\/span><span class=\"hljs-selector-class\">.1<\/span><span class=\"hljs-selector-class\">.40<\/span>     <span class=\"hljs-selector-tag\">marvin<\/span><span class=\"hljs-selector-class\">.your<\/span><span class=\"hljs-selector-class\">.lan<\/span>  <span class=\"hljs-selector-tag\">marvin<\/span>\r\n192<span class=\"hljs-selector-class\">.168<\/span><span class=\"hljs-selector-class\">.1<\/span><span class=\"hljs-selector-class\">.41<\/span>     <span class=\"hljs-selector-tag\">eddie<\/span><span class=\"hljs-selector-class\">.your<\/span><span class=\"hljs-selector-class\">.lan<\/span>   <span class=\"hljs-selector-tag\">eddie<\/span>\r\n192<span class=\"hljs-selector-class\">.168<\/span><span class=\"hljs-selector-class\">.1<\/span><span class=\"hljs-selector-class\">.42<\/span>     <span class=\"hljs-selector-tag\">hactar<\/span><span class=\"hljs-selector-class\">.your<\/span><span class=\"hljs-selector-class\">.lan<\/span>  <span class=\"hljs-selector-tag\">hactar<\/span>\r\n<\/code><\/pre>\n<p>\u2026substituting \u201cyour.lan\u201d for whatever you want your domain name to be.<\/p>\n<p>On your DHCP server (most likely your router, though pi-hole indeed can be configured into one), you\u2019ll also need to set your search domain to whatever \u201cyour.lan\u201d corresponds to.<\/p>\n<p>Finally, restart your name server:<\/p>\n<pre><code class=\"hljs\">% sudo pihole restartdns\r\n<\/code><\/pre>\n<p><strong>Additional thoughts<\/strong><\/p>\n<ul>\n<li>If all this domain name stuff confuses you, you can leave it out and live a domain-less life on your LAN.<\/li>\n<li>While you certainly can serve any name, also of hosts outside of your LAN, you probably can\u2019t outsmart Netflix to play shows from outside your geographical area <img decoding=\"async\" class=\"emoji\" title=\":slight_smile:\" src=\"https:\/\/discourse-cdn.pi-hole.net\/images\/emoji\/apple\/slight_smile.png?v=5\" alt=\":slight_smile:\" \/> . Drop that thought. It\u2019s probably against their TOS and you might end up losing your Netflix account.<\/li>\n<li>The <a href=\"http:\/\/www.thekelleys.org.uk\/dnsmasq\/docs\/dnsmasq-man.html\" rel=\"nofollow noopener\"><code>dnsmasq<\/code> manual page <span class=\"badge badge-notification clicks\" title=\"765 clicks\">765<\/span><\/a> suggests the configuration option <code>hostsdir<\/code>, but this didn\u2019t work on my raspi. Possibly i was just incompetent.&#8221;<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Adding a record: pihole -a hostrecord home.consto.com 192.168.1.10 Removing a record: pihole -a hostrecord *UPDATE* This only adds one record, and doing this command a second time removes the old record. For multiple records hosting on a PiHole, here&#8217;s the main deets as provided by llauren: &#8221; With a little configuration, you can use your &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2018\/01\/03\/adding-a-static-host-record-to-pihole\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Adding a static host record to PiHole&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[8],"tags":[228,229],"class_list":["post-239","post","type-post","status-publish","format-standard","hentry","category-server-administration","tag-pihole","tag-static-record"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=239"}],"version-history":[{"count":3,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/239\/revisions"}],"predecessor-version":[{"id":677,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/239\/revisions\/677"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}