This is an old revision of the document!
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.
Here we use the /etc/hosts file as an ad filter.
Here is a public hosts file that we will use as a starting point:
wget http://www.mvps.org/winhelp2002/hosts.txt vim hosts.txt
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.
Here we download another list and concatenate it with the previously downloaded list of adservers and your existing /etc/hosts
file:
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 >> /etc/hosts.txt
vim hosts.txt
:%s/^Mg
To strip out the DOS carriage returns, enter Ctrl-v Ctrl-m to input the ^M
.
cat hosts.txt » /etc/hosts
===== SME Server =====
http://wiki.contribs.org/Block_Adware_Sites
Here we use both adserver lists together:
<file>
wget http://www.mvps.org/winhelp2002/hosts.txt
mv hosts.txt /etc/e-smith/templates/etc/hosts/30hosts
vim /etc/e-smith/templates/etc/hosts/30hosts
</file>
Remove all lines before “#start of lines added by WinHelp2002” and save.
Now we add the contents of another list:
<file>
wget -O hosts “http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext”
cat hosts » /etc/e-smith/templates/etc/hosts/30hosts
expand-template /etc/hosts
</file>