Live data from Hacker News

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

someonewhocares.org

81–90 of 104 posts

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

#81
post #24

Earlier quoted context omitted.

If every entry routes to 127.0.0.1, what's the worst that could happen?

One can also null route them as well via 0.0.0.0. Hosts tend to die instantly that way versus timing out with 127.0.0.1

Routing to 127.0.0.1 is dumb for this reason, especially since you may be running something on port 80.

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

#83

Is there an IP block lists for Servers ? I see a lot of traffic from ip addresses that seem to probe my measly AWS EC2 instance and I wish there was a list I could feed to my NGINX or IPtables so they would just drop those packets .

Why would you want to block search engines and other crawlers?

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

#85
post #24

Earlier quoted context omitted.

If every entry routes to 127.0.0.1, what's the worst that could happen?

One can also null route them as well via 0.0.0.0. Hosts tend to die instantly that way versus timing out with 127.0.0.1

Unless you have something listening on the ports that doesn't respond or a firewall that is dropping packets on the loopback interface, "connection refused" is returned right away.

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

#87

Does any one else think a big host file slows down browsing? It there any way to fix that beside flushing the cache at random times?

it's hella faster than making a network connection for DNS

But these are all routed to localhost, so they'll just spend ages timing out...

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

#88
post #36

I once had to troubleshoot why a Windows (XP I believe) computer was taking so long to browse the web. Turns out, it had a hosts file like this (generated from Spybot, IIRC). Cleaned out the hosts file, and it ran much faster. Just something to think about when using massive hosts files.

I tested exactly this recently and a hosts file dramatically helps browsing performance.

It's true there is an up-front cost paid when first loading it, and for the initial domain lookups. After initial lookups, DNS cache takes over.

The real benefit comes because countless requests for ads, tracking scripts and counters, etc, never leave your box. Network traffic is greatly reduced.

A comprehensive hosts file dramatically improved the performance of a relative's dialup internet connection a few years ago. A web that was borderline unusable became much snappier. And web pages had almost no ad adornments.

So on balance this is a very good thing. YMMV.

Post reply on HN