The "hosts file" is a common tool in operating systems to map names to IP addresses. These mappings usually take precedence over the DNS system.

learn more… | top users | synonyms

26
votes
8answers
4k views

Browser with its own hosts file?

I have a number of staging and test servers that I need to constantly modify my hosts file to access (they depend on the domain name, so I have to change the hosts file to get them to work). I find ...
23
votes
6answers
43k views

Editing Hosts File in Windows 8

I'm trying to edit my hosts file in Windows 8 Pro. When I open C:\Windows\System32\Drivers\etc\hosts in notepad++ or any other text editor, make changes and attempt to save, I get a dialog that tells ...
19
votes
4answers
12k views

/etc/hosts getting reset in Lion

In order to do web development on my local machine, I use the /etc/hosts file to define hosts that point back to 127.0.0.1 to which I have Apache serve up via VirtualHosts. This works great, except ...
17
votes
4answers
5k views

Force Chrome to open URLs as URLs, instead of searching

I have a local Apache server running, which is defined through /etc/hosts as "apache". So I often open pages like: http://apache/website/ Normally, this works fine. However, since I am using a more ...
14
votes
2answers
2k views

Could I access a blocked website via a virtual machine if the host OS has the web address blocked in its hosts file?

I was going through this Net Nanny article that mentioned about the various ways its web filter could be bypassed by kids. Among other methods, I saw this: One way that teens can get around the ...
14
votes
5answers
6k views

Why can't I block Facebook using /etc/hosts on Mountain Lion?

It worked for a while in the old configuration, but then stopped working for some reason. Here is my /etc/hosts file from my Mountain Lion MacBook Air: 127.0.0.1 reddit.com www.reddit.com 127.0.0.1 ...
11
votes
2answers
5k views

Simulate manipulation of the etc/hosts file in Google Chrome

How can I set up Chrome to reference hostname lookups locally and not from the standard etc/hosts file? When debugging a website, it's sometimes useful to set up entries in ...
10
votes
5answers
10k views

How does localhost 127.0.0.1 work?

I found some articles related to this, but they were not sufficient for me. I want to know how the localhost works and why is it the same on many different machines? How does the localhost block the ...
10
votes
4answers
3k views

Hosts file for Chromebook?

Is there a way to modify the hosts file in Chrome OS? ­­/etc/hosts The file is read only, so trying to modify it using sudo vim does not work. I have read that disabling root filesystem ...
9
votes
4answers
7k views

Bash: lookup an IP for a host name, including /etc/hosts in search

Ubuntu 10.10+ In my script I need to lookup an IP for a given host name. If that name is listed in /etc/hosts, then command should print IP from /etc/hosts, not from DNS server. What commands I ...
8
votes
3answers
1k views

How do you edit hosts file on Windows 7

I'm trying to edit the hosts file (C:\Windows\System32\drivers\etc\hosts), because I want to setup a local redirect for my website (like I've always done in XP). However, I can't save the changes! I ...
6
votes
2answers
9k views

How to make changes to Mac /etc/hosts permanent?

On my Mac (running OS 10.6.8), I can edit my hosts file with sudo vi /etc/hosts, but changes I make don't seem to persist through restarts or possibly awaking from sleep mode. Is there a way to make ...
6
votes
4answers
13k views

Override DNS in Firefox

I'm looking for a way to override DNS entries in Firefox, for development/testing purposes. I know the normal way to do this is via the hosts file, but I cannot edit it since I don't have admin access ...
6
votes
2answers
2k views

Hosts file location in Windows 7

I know the hosts file should be under C:\Windows\System32\drivers\etc\ But for some reason, I don't have the etc directory there at all. In fact, I searched for "hosts" under C:\Windows and found ...
6
votes
4answers
2k views

Hosts file on Mountain Lion stopped working suddenly

I have used my hosts file (located in /private/etc/hosts) several months to block distracting websites during the work day. This worked all well until now. Today it suddenly stopped working. Some ...
5
votes
4answers
1k views

Windows redirect traffic to different DNS name not fixed IP address (hosts file equivalent)

Using the Windows hosts file, one can redirect traffic for a domain to a specific IP address, e.g. domainA.com --> 127.0.0.1 I am looking for a SIMPLE way to do the same, but for a target domain ...
4
votes
3answers
417 views

Editing /etc/hosts on Mac OS X Lion to use shorter host for ssh-ing

I keep having to type out ssh myusername@somereallylonghost.numb3r5.ojd202nk.net a lot. Instead of an alias, I just want to shorten that host name. I tried editing my hosts file to include shorthost ...
4
votes
2answers
7k views

How come hosts file redirection fails?

I am trying to redirect google.com to my local machine for fun and learning with this /etc/hosts file on my Mac. 127.0.0.1 www.google.com However, www.google.com still maps to the Google home page ...
4
votes
1answer
3k views

Windows hosts file equivalent on Mac?

I am doing a project and uploading to a clients test server, however they only have IP address to access and suggested editing my hosts file. I'm on a Mac, where is the hosts file?
4
votes
2answers
12k views

Why does my “hosts” file entry have no effect when accessing network shares?

I added the following line to a Windows7 hosts file: 127.0.0.1 mecserver Using ping mecserver works fine, but if I use this name to connect to the notebook (like localhost) to see the Windows ...
4
votes
2answers
2k views

Is there a way to cause chrome/ie/firefox to reload the local “hosts” file without restarting the app?

In my occupation as a sysadmin, I often find times where I need to "game the system" by editing the host file. Doing so preempts any dns records for a domain name and allows me to make the ip ...
4
votes
2answers
5k views

How to reroute all traffic using hosts file?

Is there a way to redirect all traffic to one IP in the hosts file? If not, how else could i achieve this?
4
votes
7answers
5k views

My Hosts file broke: Ping request could not find host test

Here's my hosts(with a single entry): 127.0.0.1 test But it's not working any more: C:\Documents and Settings\Administrator>ping test Ping request could not find host test. Please check the ...
3
votes
4answers
15k views

Permissions for editing hosts file on Windows 7 Home Edition

I am running Windows 7 Home Edition on my laptop. I also have an instance of Apache Server running and am trying to create a virtual directory. I have updated apache's vhost-httpd file and now need ...
3
votes
4answers
7k views

How do I tell Google Chrome to read a different hosts file?

At work in my university, the computers in the office all use Windows XP, latest service pack. They've given each one of us a regular account, with no way of installing programs or making ...
3
votes
2answers
6k views

Run as administrator from command line on Windows 8

I am trying to run Notepad as admin so I can edit my hosts file from the command line. I have tried runas /user:(myusername)\administrator "notepad c:\windows\system32\drivers\etc\hosts" I then input ...
3
votes
4answers
2k views

Is it a good idea to tweak the hosts file to speed up internet browsing?

Yesterday I came across a Firefox extension called Speed DNS which claims to speed up browsing by performing DNS lookups in advance. According to the author, it "does DNS pre-resolution of all the ...
3
votes
3answers
643 views

I accidentally hijacked my localhost

Opening localhost in the browser is pointing a local webpage (examplePage) after playing with some config files a while back, and I can't figure out how to restore the default behavior. Background: ...
3
votes
2answers
1k views

Quickly edit / change hosts file on Windows

I routinely need to add / remove / update hosts on a Windows 7 machine to add links to staging / test servers. On Mac I can use ghosts with the syntax ghost add staging-server.local ...
3
votes
2answers
1k views

How can I redirect HTTP requests to use HTTPS?

Is it possible to automatically redirect HTTP to HTTPS? Can I amend my host file in such a way that when I visit http://www.hsbc.co.uk it will redirect me to https://www.hsbc.co.uk? or is there ...
3
votes
1answer
1k views

How to block IP Address via Windows Host

I want to block access to a certain ip address via windows host. This is the ip address 41.190.8.17. And this is the content of my host file. # localhost name resolution is handle within DNS ...
3
votes
1answer
372 views

Hosts file - Many entries

I noticed Spybot - Search & Destroy adds almost 15k entries on the hosts file (C:\Windows\System32\drivers\etc\hosts) if you decide to immunize. Does this decrease the computer performance, ...
3
votes
1answer
2k views

Chrome, Safari, IE not recognizing hosts file in Windows 7

I have a new clean install of Windows 7. I've edited the hosts file and when I ping from the command line the correct settings are used — the ping goes to a local network server instead of out ...
3
votes
4answers
3k views

Expected behavior with duplicate NT hosts file entries?

I know that you shouldn't have duplicate entries in your Windows NT hosts file, windows\system32\drivers\etc\hosts, but what is the expected behavior if you have them? You can have multiple entries ...
3
votes
1answer
91 views

How can I view different internally hosted websites, set up as virtual hosts?

I have an old machine that I've converted into a web server. I'm wondering what the best way to make the websites viewable on the internal network, without using a proxy. I experimented with BIND, ...
3
votes
2answers
1k views

why /etc/hosts don't effect to my firefox on Ubuntu 10.04?

I tried to block some hosts to load from them ads and scripts. for example in /etc/hosts: 127.0.0.1 web-visor.com 0.0.0.0 c1.web-visor.com Why after editing and saving the file, firefox (after ...
3
votes
1answer
507 views

Access mac virtual host from a virtual machine

Here's my setup: I'm developing a website on a mac. I created a virtual host, so I can open up my browser, type http://cpp and it will point to the right directory. I want to test this website out ...
3
votes
0answers
3k views

Windows 8. Hosts file doesn't work

I am using Windows 8 developer preview (x64) for testing purposes. I want to access some local network resource by DNS. So, I've added next line to my hosts file (%sindir%/system32/drivers/etc/hosts): ...
2
votes
2answers
3k views

Hosts file switcher on linux

It appears there are a ton of utilities to manage the hosts file on OSX. I haven't been able to find even one like http://www.macupdate.com/app/mac/29949/gas-mask for linux. I keep my hosts file ...
2
votes
2answers
9k views

Why is a reboot not required after changing HOSTS file content

I was having a discussion with someone who asked me whether a Linux OS has to be rebooted when the hosts file is modified. From personal experience, on Windows I change the file but don't reboot and ...
2
votes
2answers
1k views

My hosts file is broken (windows won't read it)

I have Windows 7 Pro 64 bit and it won't read the hosts file ! I've googled around for quite a long time but I can't fix it, maybe someone here can help me. I can't see the .txt extension on the ...
2
votes
3answers
3k views

How do you edit the 'hosts' file in windows 7? [duplicate]

Possible Duplicate: How do you edit hosts file on Windows 7 I need to edit the hosts file so that I could restrict some sites from opening. I have tried to open it and edit it but when I ...
2
votes
5answers
2k views

Chrome does not follow hosts file

I have custom domains set up for internal web site testing in my /etc/hosts file. I try to access them in Chrome, and I get routed to a Google search instead. But when I ping the domains, they ...
2
votes
3answers
144 views

How dangerous is it to translate IPs directly via hosts in Windows

Sorry for the inconvenience, as English is not my native. I use hosts to access some websites as DNS is polluted. My question is, take www.google.com as an example. If I am successfully social ...
2
votes
5answers
14k views

With Windows 7, why is an entry in the hosts file not working?

I updated some entries in the hosts file at C:\WINDOWS\System32\drivers\etc. As a test, I decided to make Google point to 127.0.0.1. # Additionally, comments (such as these) may be inserted on ...
2
votes
2answers
12k views

How to reset hosts file back to default?

How do I reset my hosts file back to default? Windows 7 Ultimate 32bit C:\WINDOWS\system32\drivers\etc
2
votes
1answer
1k views

Hosts file in Windows 7 screwed up!

I recently changed my Hosts file to block some websites in Windows 7. Now I think it is blocking lot of other sites that were not added to Hosts file. Is there any way to escape this? I tried to ...
2
votes
1answer
3k views

How to add multiple IPv6 address for single host in /etc/hosts?

I want that a name should be resolved with multiple IPv6 addresses. I don't have access to a DNS server and I don't want to run a demon for that purpose. I want to add the entry in /etc/hosts and it ...
2
votes
3answers
799 views

ad blocking host file, shared to all computers on local network

I currently update my local hosts file with advertising server domain names and direct them to nowhere. Well, almost nowhere. I point them to 127.0.0.1 and I don't have a web service running so it is ...
2
votes
1answer
1k views

IE ignores hosts file; works in Firefox

I've edited my hosts file in a Windows 7 VM, but it doesn't work in IE. It works with Firefox, though. I hope this itemized list will help more than a verbose description. Environment Windows 7 in ...