User Tools

Site Tools


internet:security:hosts_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
internet:security:hosts_file [2012/04/16 15:28]
gcooper created
internet:security:hosts_file [2019/04/23 10:14] (current)
gcooper
Line 1: Line 1:
 ====== Hosts File ====== ====== Hosts File ======
 +
 +See also a **better way**: **[[internet:security:pihole|Pi-Hole DNS Sinkhole and Add Blocker]]**
  
 The /etc/hosts file contains name resolution info that overrides DNS.  You might add entries in the /etc/hosts file that is not in DNS. The /etc/hosts file contains name resolution info that overrides DNS.  You might add entries in the /etc/hosts file that is not in DNS.
Line 17: Line 19:
 </file> </file>
  
-Remove all lines before:+Remove all lines before ''# [Start of entries generated by MVPS HOSTS]'' and append the rest to your own ''/etc/hosts'' file...or continue on to add the second list. 
 + 
 +==== yoyo.org ==== 
 + 
 +Here we download another list and concatenate it with the previously downloaded list of adservers and your existing ''/etc/hosts'' file:
  
 <file> <file>
-#start of lines added by WinHelp2002+wget -O hosts "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext" 
 +sed -i 's/127.0.0.1/0.0.0.0/g' hosts 
 +cat hosts >> hosts.txt
 </file> </file>
  
-and append the rest to your own /etc/hosts file.+<file
 +vim hosts.txt
  
-==== yoyo.org ====+# Set to unix file format 
 +:set ff=unix
  
-<file> +# Strip out DOS carriage returns enter Ctrl-v Ctrl-m to input the ''^M'' 
-wget -O hosts "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext"+:%s/^M//
 + 
 +# Strip all blank lines and comment lines 
 +:g/\v^(#|$)/
 + 
 +# Sort and remove duplicate lines 
 +:sort u
  
-cat hosts >> /etc/hosts 
 cat hosts.txt >> /etc/hosts cat hosts.txt >> /etc/hosts
 </file> </file>
Line 37: Line 52:
  
 http://wiki.contribs.org/Block_Adware_Sites http://wiki.contribs.org/Block_Adware_Sites
 +
 +Here we use both adserver lists together:
  
 <file> <file>
Line 46: Line 63:
 </file> </file>
  
-Remove all lines before:+Remove all lines before "#start of lines added by WinHelp2002" and save.
  
-<file> +Now we add the contents of another list:
-#start of lines added by WinHelp2002 +
-</file>+
  
 <file> <file>
internet/security/hosts_file.1334611699.txt.gz · Last modified: 2012/04/16 15:28 by gcooper