Note about hosts file for pi-hole

This commit is contained in:
Bob Mottram 2017-08-22 10:51:03 +01:00
parent c72c4fe754
commit 36d73b2a6c
2 changed files with 33 additions and 20 deletions

View File

@ -32,11 +32,17 @@ When that's done select *About this system* from the control panel and see the I
* On each client system within your local network * On each client system within your local network
Make sure that you add the static IP address for the server to */etc/hosts*.
#+begin_src bash
STATIC_IP=[your server static IP]
sudo echo "$STATIC_IP [your domain name]" >> /etc/hosts
#+end_src
On Arch/Parabola: On Arch/Parabola:
#+begin_src bash #+begin_src bash
sudo pacman -S openresolv sudo pacman -S openresolv
STATIC_IP=[your server static IP]
sudo sed -i "s|#name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf sudo sed -i "s|#name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf
sudo sed -i "s|name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf sudo sed -i "s|name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf
sudo chattr -i /etc/resolv.conf sudo chattr -i /etc/resolv.conf
@ -47,7 +53,6 @@ Or on a Debian based system:
#+begin_src bash #+begin_src bash
sudo apt-get install resolvconf sudo apt-get install resolvconf
STATIC_IP=[your server static IP]
echo 'domain localdomain' > /tmp/resolvconf echo 'domain localdomain' > /tmp/resolvconf
echo 'search localdomain' >> /tmp/resolvconf echo 'search localdomain' >> /tmp/resolvconf
echo "nameserver $STATIC_IP" >> /tmp/resolvconf echo "nameserver $STATIC_IP" >> /tmp/resolvconf

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <head>
<!-- 2017-08-21 Mon 22:43 --> <!-- 2017-08-22 Tue 10:50 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title></title> <title></title>
@ -264,9 +264,9 @@ You can block ads for any devices connected to your local network by installing
Also don't expect perfection. Though many ads may be blocked by this system some will still get through. It's a constant cat and mouse game between advertisers and blockers. Also don't expect perfection. Though many ads may be blocked by this system some will still get through. It's a constant cat and mouse game between advertisers and blockers.
</p> </p>
<div id="outline-container-orgd27901b" class="outline-2"> <div id="outline-container-org4f58654" class="outline-2">
<h2 id="orgd27901b">Set a static IP address</h2> <h2 id="org4f58654">Set a static IP address</h2>
<div class="outline-text-2" id="text-orgd27901b"> <div class="outline-text-2" id="text-org4f58654">
<p> <p>
Ensure that your system has a static local IP address (typically 192.168..) using the option on the control panel. You will also need to know the IP address of your internet router, which is usually <b>192.168.1.1</b> or <b>192.168.1.254</b>. Ensure that your system has a static local IP address (typically 192.168..) using the option on the control panel. You will also need to know the IP address of your internet router, which is usually <b>192.168.1.1</b> or <b>192.168.1.254</b>.
</p> </p>
@ -277,16 +277,25 @@ When that's done select <b>About this system</b> from the control panel and see
</div> </div>
</div> </div>
<div id="outline-container-orgf682f48" class="outline-2"> <div id="outline-container-orgc2fe39b" class="outline-2">
<h2 id="orgf682f48">On each client system within your local network</h2> <h2 id="orgc2fe39b">On each client system within your local network</h2>
<div class="outline-text-2" id="text-orgf682f48"> <div class="outline-text-2" id="text-orgc2fe39b">
<p>
Make sure that you add the static IP address for the server to <b>/etc/hosts</b>.
</p>
<div class="org-src-container">
<pre><code class="src src-bash"><span class="org-variable-name">STATIC_IP</span>=[your server static IP]
sudo echo <span class="org-string">"$STATIC_IP [your domain name]"</span> &gt;&gt; /etc/hosts
</code></pre>
</div>
<p> <p>
On Arch/Parabola: On Arch/Parabola:
</p> </p>
<div class="org-src-container"> <div class="org-src-container">
<pre><code class="src src-bash">sudo pacman -S openresolv <pre><code class="src src-bash">sudo pacman -S openresolv
<span class="org-variable-name">STATIC_IP</span>=[your server static IP]
sudo sed -i <span class="org-string">"s|#name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf sudo sed -i <span class="org-string">"s|#name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf
sudo sed -i <span class="org-string">"s|name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf sudo sed -i <span class="org-string">"s|name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf
sudo chattr -i /etc/resolv.conf sudo chattr -i /etc/resolv.conf
@ -300,7 +309,6 @@ Or on a Debian based system:
<div class="org-src-container"> <div class="org-src-container">
<pre><code class="src src-bash">sudo apt-get install resolvconf <pre><code class="src src-bash">sudo apt-get install resolvconf
<span class="org-variable-name">STATIC_IP</span>=[your server static IP]
<span class="org-builtin">echo</span> <span class="org-string">'domain localdomain'</span> &gt; /tmp/resolvconf <span class="org-builtin">echo</span> <span class="org-string">'domain localdomain'</span> &gt; /tmp/resolvconf
<span class="org-builtin">echo</span> <span class="org-string">'search localdomain'</span> &gt;&gt; /tmp/resolvconf <span class="org-builtin">echo</span> <span class="org-string">'search localdomain'</span> &gt;&gt; /tmp/resolvconf
<span class="org-builtin">echo</span> <span class="org-string">"nameserver $STATIC_IP"</span> &gt;&gt; /tmp/resolvconf <span class="org-builtin">echo</span> <span class="org-string">"nameserver $STATIC_IP"</span> &gt;&gt; /tmp/resolvconf
@ -312,9 +320,9 @@ sudo resolvconf -u
</div> </div>
</div> </div>
<div id="outline-container-org1c0c248" class="outline-2"> <div id="outline-container-org3124632" class="outline-2">
<h2 id="org1c0c248">On your internet router</h2> <h2 id="org3124632">On your internet router</h2>
<div class="outline-text-2" id="text-org1c0c248"> <div class="outline-text-2" id="text-org3124632">
<p> <p>
If you can access the settings on your local internet router then this is the simplest way to provide ad blocking for all devices which connect to it. Unfortunately some router models don't let you edit the DNS settings and if that's the case you might want to consider getting a different router. If you can access the settings on your local internet router then this is the simplest way to provide ad blocking for all devices which connect to it. Unfortunately some router models don't let you edit the DNS settings and if that's the case you might want to consider getting a different router.
</p> </p>
@ -324,9 +332,9 @@ Edit the DNS settings and add the IPv4 address which you got from the control pa
</p> </p>
</div> </div>
<div id="outline-container-org8f47626" class="outline-3"> <div id="outline-container-org2c8b1c5" class="outline-3">
<h3 id="org8f47626">LibreCMC</h3> <h3 id="org2c8b1c5">LibreCMC</h3>
<div class="outline-text-3" id="text-org8f47626"> <div class="outline-text-3" id="text-org2c8b1c5">
<p> <p>
On a router running LibreCMC from the <b>Network</b> menu select <b>DHCP and DNS</b>. Enter the static IP address of your Freedombone system within <b>DNS Forwardings</b>, then at the bottom of the page click on <b>Save &amp; Apply</b>. Any devices which connect to your router will now have ad blocking. On a router running LibreCMC from the <b>Network</b> menu select <b>DHCP and DNS</b>. Enter the static IP address of your Freedombone system within <b>DNS Forwardings</b>, then at the bottom of the page click on <b>Save &amp; Apply</b>. Any devices which connect to your router will now have ad blocking.
</p> </p>
@ -334,9 +342,9 @@ On a router running LibreCMC from the <b>Network</b> menu select <b>DHCP and DNS
</div> </div>
</div> </div>
<div id="outline-container-orgb10bacb" class="outline-2"> <div id="outline-container-orgff38fd6" class="outline-2">
<h2 id="orgb10bacb">Configuring block lists</h2> <h2 id="orgff38fd6">Configuring block lists</h2>
<div class="outline-text-2" id="text-orgb10bacb"> <div class="outline-text-2" id="text-orgff38fd6">
<p> <p>
You can configure the block lists which the system uses by going to the <b>administrator control panel</b>, selecting <b>App Settings</b> then choosing <b>pihole</b>. You can also add any extra domain names to the whitelist if they're being wrongly blocked or to the blacklist if they're not blocked by the current lists. You can configure the block lists which the system uses by going to the <b>administrator control panel</b>, selecting <b>App Settings</b> then choosing <b>pihole</b>. You can also add any extra domain names to the whitelist if they're being wrongly blocked or to the blacklist if they're not blocked by the current lists.
</p> </p>