Re:Using a Hosts File To Make The Internet Not Suck As Much
by tsewlliw on Friday February 22, 2013 @10:35AM
(#5264669)
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.
[ Parent
| on HN ]
Re:Using a Hosts File To Make The Internet Not Suck As Much
by sp332 on Friday February 22, 2013 @10:42AM
(#5264711)
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.
Re:Using a Hosts File To Make The Internet Not Suck As Much
by lysol on Friday February 22, 2013 @10:53AM
(#5264806)
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
by sp332 on Friday February 22, 2013 @10:58AM
(#5264843)
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.
Re:Using a Hosts File To Make The Internet Not Suck As Much
by mnarayan01 on Friday February 22, 2013 @11:34AM
(#5265094)
IIRC, addresses 0/8 addresses are for multicast, so depending on your and your upstream's router configuration, that potentially sends those requests to a weird set of hosts on your class-A.
Re:Using a Hosts File To Make The Internet Not Suck As Much
by dsl on Friday February 22, 2013 @01:59PM
(#5265944)
Multicast is 224.0.0.0/4 (224-239). 0/8 should only be used as a source address for "local network" traffic and never a destination.
Re:Using a Hosts File To Make The Internet Not Suck As Much
by brown9-2 on Friday February 22, 2013 @10:57AM
(#5264833)
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.