This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
internet:security:hosts_file [2015/12/26 22:32] gcooper |
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 15: | Line 17: | ||
vim hosts.txt | vim hosts.txt | ||
- | |||
- | :%s/^M//g | ||
</ | </ | ||
- | :!: To strip out the DOS carriage returns, enter Ctrl-v Ctrl-m to input the '' | + | Remove |
- | + | ||
- | To use just this one list of adservers, remove | + | |
==== yoyo.org ==== | ==== yoyo.org ==== | ||
- | Here we download another list and concatenate it with the previously downloaded list of adservers and your exxisting | + | Here we download another list and concatenate it with the previously downloaded list of adservers and your existing '' |
< | < | ||
wget -O hosts " | wget -O hosts " | ||
sed -i ' | sed -i ' | ||
- | cat hosts >> /etc/hosts | + | cat hosts >> |
+ | </file> | ||
+ | |||
+ | < | ||
+ | vim hosts.txt | ||
+ | |||
+ | # Set to unix file format | ||
+ | :set ff=unix | ||
+ | |||
+ | # Strip out DOS carriage returns - enter Ctrl-v Ctrl-m to input the '' | ||
+ | :%s/^M//g | ||
+ | |||
+ | # Strip all blank lines and comment lines | ||
+ | : | ||
+ | |||
+ | # Sort and remove duplicate lines | ||
+ | :sort u | ||
cat hosts.txt >> /etc/hosts | cat hosts.txt >> /etc/hosts | ||
</ | </ |