Live data from Hacker News

Using a Hosts File To Make The Internet Not Suck As Much

someonewhocares.org

11–20 of 104 posts

Re: Using a Hosts File To Make The Internet Not Suck As Much

#12
post #6
post #4

for domains you don't want to route try 192.0.2.x - that range is reserved for examples and won't end up with spurious requests to stuff you're running on localhost.

Will browsers immediately fail the connection, or will it try to make the connection and wait for a timeout? I generally use 0.42.42.42 because Class-A addresses can't start with 0, so they fail immediately.

If you're running a web server locally on port 80, the webserver will handle the request. If no service is listening on port 80 your networking stack will not be able to open a tcp connection and it will be actively refused, unless you're using some kind of terrible software firewall.

Re: Using a Hosts File To Make The Internet Not Suck As Much

#14
post #2

In Australia the government went on this rampage of attempting to "protect" people through censorship. Perhaps a better solution would have simply been to ask Microsoft and Apple to distribute computers with a pre-loaded host file. Nice and easy to opt out, all while providing some decent protection from obvious silly sites.

Governments don't know enough about the internet to know what a hosts file is and I don't think we want them to.

Re: Using a Hosts File To Make The Internet Not Suck As Much

#15
Think twice before using someone else's hosts file, unless you can actually review every entry. Not that I really think anything funny is happening here, but it is a huge security risk to use non-authoritative DNS like this by taking someone else on their word that their hosts file is legit.

Re: Using a Hosts File To Make The Internet Not Suck As Much

#16
post #3

I like the idea of this, just deciding how to balance it with my own hosts file that has local entries vs keeping this one updated (presuming it will be) Interesting that something that looks to have taken a fair bit of work and is moderately useful hasn't had a comment on it.

https://code.google.com/p/gmask/

Neat, thanks!

Re: Using a Hosts File To Make The Internet Not Suck As Much

#17
post #6
post #4

for domains you don't want to route try 192.0.2.x - that range is reserved for examples and won't end up with spurious requests to stuff you're running on localhost.

Will browsers immediately fail the connection, or will it try to make the connection and wait for a timeout? I generally use 0.42.42.42 because Class-A addresses can't start with 0, so they fail immediately.

This would depend on your network setup - it seems unlikely that the OS would automatically refuse to route a request to there. On OS X:

    $ curl --connect-timeout 5 -v 192.0.2.1
    * About to connect() to 192.0.2.1 port 80 (#0)
    *   Trying 192.0.2.1...
    * Connection timed out after 5011 milliseconds
    * Closing connection 0
    curl: (28) Connection timed out after 5011 milliseconds
So your browser will likely end up trying the connection and timing out after a while.

Re: Using a Hosts File To Make The Internet Not Suck As Much

#19

I'd recommend Gas Mask for anyone editing their hosts file: (Plug for own site with similar stuff): http://pineapple.io/resources/gas-mask Gas mas direct link: https://code.google.com/p/gmask/

For windows use http://www.abelhadigital.com/hostsman (free, but closed source). It also has a list of popular 3rd party supplied host files to block unwanted sites, with options to update them

Re: Using a Hosts File To Make The Internet Not Suck As Much

#20
post #12
post #6

Earlier quoted context omitted.

Will browsers immediately fail the connection, or will it try to make the connection and wait for a timeout? I generally use 0.42.42.42 because Class-A addresses can't start with 0, so they fail immediately.

If you're running a web server locally on port 80, the webserver will handle the request. If no service is listening on port 80 your networking stack will not be able to open a tcp connection and it will be actively refused, unless you're using some kind of terrible software firewall.

Using Firefox in Windows 7, it takes 4-5 seconds to fail. The other address I gave fails so fast sometimes the favicon doesn't even blink.
Post reply on HN