瀏覽代碼

Note about hosts file for pi-hole

Bob Mottram 7 年之前
父節點
當前提交
36d73b2a6c
共有 2 個文件被更改,包括 33 次插入20 次删除
  1. 7
    2
      doc/EN/app_pihole.org
  2. 26
    18
      website/EN/app_pihole.html

+ 7
- 2
doc/EN/app_pihole.org 查看文件

32
 
32
 
33
 * On each client system within your local network
33
 * On each client system within your local network
34
 
34
 
35
+Make sure that you add the static IP address for the server to */etc/hosts*.
36
+
37
+#+begin_src bash
38
+STATIC_IP=[your server static IP]
39
+sudo echo "$STATIC_IP [your domain name]" >> /etc/hosts
40
+#+end_src
41
+
35
 On Arch/Parabola:
42
 On Arch/Parabola:
36
 
43
 
37
 #+begin_src bash
44
 #+begin_src bash
38
 sudo pacman -S openresolv
45
 sudo pacman -S openresolv
39
-STATIC_IP=[your server static IP]
40
 sudo sed -i "s|#name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf
46
 sudo sed -i "s|#name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf
41
 sudo sed -i "s|name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf
47
 sudo sed -i "s|name_servers=.*|name_servers=$STATIC_IP|g" /etc/resolvconf.conf
42
 sudo chattr -i /etc/resolv.conf
48
 sudo chattr -i /etc/resolv.conf
47
 
53
 
48
 #+begin_src bash
54
 #+begin_src bash
49
 sudo apt-get install resolvconf
55
 sudo apt-get install resolvconf
50
-STATIC_IP=[your server static IP]
51
 echo 'domain localdomain' > /tmp/resolvconf
56
 echo 'domain localdomain' > /tmp/resolvconf
52
 echo 'search localdomain' >> /tmp/resolvconf
57
 echo 'search localdomain' >> /tmp/resolvconf
53
 echo "nameserver $STATIC_IP" >> /tmp/resolvconf
58
 echo "nameserver $STATIC_IP" >> /tmp/resolvconf

+ 26
- 18
website/EN/app_pihole.html 查看文件

3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
5
 <head>
5
 <head>
6
-<!-- 2017-08-21 Mon 22:43 -->
6
+<!-- 2017-08-22 Tue 10:50 -->
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
8
 <meta name="viewport" content="width=device-width, initial-scale=1" />
9
 <title></title>
9
 <title></title>
264
 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.
264
 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.
265
 </p>
265
 </p>
266
 
266
 
267
-<div id="outline-container-orgd27901b" class="outline-2">
268
-<h2 id="orgd27901b">Set a static IP address</h2>
269
-<div class="outline-text-2" id="text-orgd27901b">
267
+<div id="outline-container-org4f58654" class="outline-2">
268
+<h2 id="org4f58654">Set a static IP address</h2>
269
+<div class="outline-text-2" id="text-org4f58654">
270
 <p>
270
 <p>
271
 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>.
271
 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>.
272
 </p>
272
 </p>
277
 </div>
277
 </div>
278
 </div>
278
 </div>
279
 
279
 
280
-<div id="outline-container-orgf682f48" class="outline-2">
281
-<h2 id="orgf682f48">On each client system within your local network</h2>
282
-<div class="outline-text-2" id="text-orgf682f48">
280
+<div id="outline-container-orgc2fe39b" class="outline-2">
281
+<h2 id="orgc2fe39b">On each client system within your local network</h2>
282
+<div class="outline-text-2" id="text-orgc2fe39b">
283
+<p>
284
+Make sure that you add the static IP address for the server to <b>/etc/hosts</b>.
285
+</p>
286
+
287
+<div class="org-src-container">
288
+<pre><code class="src src-bash"><span class="org-variable-name">STATIC_IP</span>=[your server static IP]
289
+sudo echo <span class="org-string">"$STATIC_IP [your domain name]"</span> &gt;&gt; /etc/hosts
290
+</code></pre>
291
+</div>
292
+
283
 <p>
293
 <p>
284
 On Arch/Parabola:
294
 On Arch/Parabola:
285
 </p>
295
 </p>
286
 
296
 
287
 <div class="org-src-container">
297
 <div class="org-src-container">
288
 <pre><code class="src src-bash">sudo pacman -S openresolv
298
 <pre><code class="src src-bash">sudo pacman -S openresolv
289
-<span class="org-variable-name">STATIC_IP</span>=[your server static IP]
290
 sudo sed -i <span class="org-string">"s|#name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf
299
 sudo sed -i <span class="org-string">"s|#name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf
291
 sudo sed -i <span class="org-string">"s|name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf
300
 sudo sed -i <span class="org-string">"s|name_servers=.*|name_servers=$STATIC_IP|g"</span> /etc/resolvconf.conf
292
 sudo chattr -i /etc/resolv.conf
301
 sudo chattr -i /etc/resolv.conf
300
 
309
 
301
 <div class="org-src-container">
310
 <div class="org-src-container">
302
 <pre><code class="src src-bash">sudo apt-get install resolvconf
311
 <pre><code class="src src-bash">sudo apt-get install resolvconf
303
-<span class="org-variable-name">STATIC_IP</span>=[your server static IP]
304
 <span class="org-builtin">echo</span> <span class="org-string">'domain localdomain'</span> &gt; /tmp/resolvconf
312
 <span class="org-builtin">echo</span> <span class="org-string">'domain localdomain'</span> &gt; /tmp/resolvconf
305
 <span class="org-builtin">echo</span> <span class="org-string">'search localdomain'</span> &gt;&gt; /tmp/resolvconf
313
 <span class="org-builtin">echo</span> <span class="org-string">'search localdomain'</span> &gt;&gt; /tmp/resolvconf
306
 <span class="org-builtin">echo</span> <span class="org-string">"nameserver $STATIC_IP"</span> &gt;&gt; /tmp/resolvconf
314
 <span class="org-builtin">echo</span> <span class="org-string">"nameserver $STATIC_IP"</span> &gt;&gt; /tmp/resolvconf
312
 </div>
320
 </div>
313
 </div>
321
 </div>
314
 
322
 
315
-<div id="outline-container-org1c0c248" class="outline-2">
316
-<h2 id="org1c0c248">On your internet router</h2>
317
-<div class="outline-text-2" id="text-org1c0c248">
323
+<div id="outline-container-org3124632" class="outline-2">
324
+<h2 id="org3124632">On your internet router</h2>
325
+<div class="outline-text-2" id="text-org3124632">
318
 <p>
326
 <p>
319
 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.
327
 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.
320
 </p>
328
 </p>
324
 </p>
332
 </p>
325
 </div>
333
 </div>
326
 
334
 
327
-<div id="outline-container-org8f47626" class="outline-3">
328
-<h3 id="org8f47626">LibreCMC</h3>
329
-<div class="outline-text-3" id="text-org8f47626">
335
+<div id="outline-container-org2c8b1c5" class="outline-3">
336
+<h3 id="org2c8b1c5">LibreCMC</h3>
337
+<div class="outline-text-3" id="text-org2c8b1c5">
330
 <p>
338
 <p>
331
 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.
339
 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.
332
 </p>
340
 </p>
334
 </div>
342
 </div>
335
 </div>
343
 </div>
336
 
344
 
337
-<div id="outline-container-orgb10bacb" class="outline-2">
338
-<h2 id="orgb10bacb">Configuring block lists</h2>
339
-<div class="outline-text-2" id="text-orgb10bacb">
345
+<div id="outline-container-orgff38fd6" class="outline-2">
346
+<h2 id="orgff38fd6">Configuring block lists</h2>
347
+<div class="outline-text-2" id="text-orgff38fd6">
340
 <p>
348
 <p>
341
 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.
349
 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.
342
 </p>
350
 </p>