Alternative to 127.0.0.1 in hosts file

5,781

Solution 1

Depending on your browser, the error message should show the unavailable IP address (127.0.0.1):-

  • Firefox38 shows: Firefox can't establish a connection to the server at 127.0.0.1.
  • Chrome43 (Details) shows: Google Chrome's connection attempt to 127.0.0.1 was rejected.
  • IE11 shows: Make sure that the web address http://127.0.0.1 is correct.

Otherwise, you can redirect to your router's web interface: it won't be an error message, but it will be recognisably distinct.

Solution 2

sundar, with respect to your comment on blocking subdomains with wildcards, there is a tool for Windows called Acrylic DNS Proxy (http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome) which allows just that, much like dnsmask in linux. (it equates to, however, running a server in background on your machine).

Solution 3

I find that 0.0.0.0 is preferable because I run a local web server and 127.0.0.1 is a local loop-back address to my web server. All entries in the hosts file pointing to 127.0.0.1 renders the local webserver home or error pages (depending on the request) which takes CPU cycles, memory and thus time.

0.0.0.0 is instantly rejected and this speeds up the process greatly (for my atypical setup anyway).

I believe Skype also opens port 80 (local web server) which I would imagine would also take time to respond to but I haven't tested this personally.

Share:
5,781

Related videos on Youtube

Sundar R
Author by

Sundar R

#SOreadytohelp

Updated on September 18, 2022

Comments

  • Sundar R
    Sundar R almost 2 years

    I have a bunch of websites blocked at the system level in my Windows 7 by using the etc/hosts file. So far, I've done it the usual way, by giving 127.0.0.1 as the website's IP address.

    However, I'd like to be able to know when it's my hosts file blocking things, as opposed to my ISP doing it or the server just plain not being available.

    It would be useful to be able to specify some IP other than 127.0.0.1 that always returns a quick-loading page which doesn't change with time, as a reminder that I've blocked this URL, so the content doesn't really matter as long as it a simple, fast page with unique content.

    Is there any such reliable IP address that responds to non-existing path queries with a distinct-looking, fast loading page (probably an error page, which works for this)?

    Or is there any other way of accomplishing this idea (other than keeping a local web server continuously running in the background just for this)?

    • AFH
      AFH about 9 years
      Depending on your browser, the error message should show the unavailable IP address (127.0.0.1). Otherwise, you can redirect to your router's web interface: it won't be an error message, but it will be recognisably distinct.
    • Sundar R
      Sundar R about 9 years
      Firefox doesn't seem to show the IP, but the router suggestion is quite an interesting possibility. Could you also add that as an answer, which would make it more visible to future visitors too?
    • Daniel B
      Daniel B about 8 years
      What’s wrong with having a web server running? Using something low-resource like NodeJS, the desired effect could be achieved with almost no code/programming/configuration at all.
    • Robert Columbia
      Robert Columbia about 7 years
      In addition to router configuration pages, some network printers run their own web servers where you can view toner levels, etc.
  • Sundar R
    Sundar R almost 9 years
    I ended up using my firewall's block feature, since I wanted to block all subdomains of the site too (and hosts requires each subdomain to be specified individually, no wildcards), and Comodo shows a neat "this website blocked by your admin" page too. That said, the "redirect to router's interface" suggestion is quite useful and something that might come in handy later, so I'm accepting this answer.