This shows you the differences between two versions of the page.
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: | ||
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: | ||
</ | </ | ||
- | Remove all lines before: | + | Remove all lines before |
+ | |||
+ | ==== yoyo.org ==== | ||
+ | |||
+ | Here we download another list and concatenate it with the previously downloaded list of adservers and your existing ''/ | ||
< | < | ||
- | #start of lines added by WinHelp2002 | + | wget -O hosts " |
+ | sed -i ' | ||
+ | cat hosts >> hosts.txt | ||
</ | </ | ||
- | and append the rest to your own / | + | <file> |
+ | vim hosts.txt | ||
- | ==== yoyo.org ==== | + | # Set to unix file format |
+ | :set ff=unix | ||
- | < | + | # Strip out DOS carriage returns |
- | wget -O hosts "http://pgl.yoyo.org/adservers/serverlist.php? | + | :%s/^M//g |
+ | |||
+ | # 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 | ||
</ | </ | ||
Line 37: | Line 52: | ||
http:// | http:// | ||
+ | |||
+ | Here we use both adserver lists together: | ||
< | < | ||
Line 46: | Line 63: | ||
</ | </ | ||
- | Remove all lines before: | + | Remove all lines before |
- | < | + | Now we add the contents |
- | # | + | |
- | </ | + | |
< | < |