Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerate and Reduce Host File Sizes #37

Open
TraderStf opened this issue Feb 15, 2015 · 2 comments
Open

Accelerate and Reduce Host File Sizes #37

TraderStf opened this issue Feb 15, 2015 · 2 comments

Comments

@TraderStf
Copy link
Contributor

I have read several articles about reducing the host file, here is a summary.

Using 0 is

  • smaller than 127.0.0.1, it is 1 character instead of 9.
  • faster because 0.0.0.0 or 0 block the connection immediately. Where as 127.0.0.1 tries to connect first, and then must go through the loopback.

An additional way to reduce the host file size is by grouping several hostnames on one single line.

Obviously, removing duplicate hostnames, empty lines, useless spaces or tabs, and comments will also help.

An example:

127.0.0.1         localhost
255.255.255.255   broadcasthost
::1               localhost
fe80::1%lo0       localhost

# Comment here
127.0.0.1      host1
127.0.0.1      host2
127.0.0.1 host3
127.0.0.1 host4
192.168.2.7    testa#test for john
192.168.2.7  testserverb
0 adstat.com # naughty tracker
0 mk1.adstat.com
0 mk2.adstat.com
0 mk3.adstat.com
0 mk4.adstat.com
0 mk5.adstat.com
0 mk6.adstat.com
127.0.0.1      host2 #look a duplicate

This host file becomes, by using all these technics including the 9 limit:

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
0 host1 host2 host3 host4 adstat.com mk1.adstat.com mk2.adstat.com mk3.adstat.com mk4.adstat.com
0 mk5.adstat.com mk6.adstat.com
192.168.2.7 testa testserverb

The first file is reduced by almost 55 %.

When you have a host file of 2617 KB, that makes a huge difference, it is reduced by ~44 %.
For a huge host file, take a look at http://sourceforge.net/projects/adzhosts/

WARNING

  • On some OS or OS specific versions:
    • a maximum of 9 hosts on one line are recognized, the following hosts on the line are ignored.
    • a single 0 does not work, use 0.0.0.0 instead, and some do not even support 0.0.0.0 and multiple hostnames on a line.
  • 127.0.0.1 must be kept for "localhost", don't use 0.0.0.0 or 0 or some programs might encounter problems!

Have a nice day.

@TraderStf
Copy link
Contributor Author

UP 👍 , for using "0" instead of "127.0.0.1"

@mrchief
Copy link

mrchief commented Feb 6, 2019

You can use the list from something like https://github.com/StevenBlack/hosts which uses 0 instead of 127.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants