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

27
votes
6answers
47k 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 ...
27
votes
8answers
5k 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 ...
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 ...
19
votes
3answers
25k views

What is the relevance of “fe80::1%lo0 localhost” in /etc/hosts?

Following are the entries in my /etc/hosts. I was wondering what is the last entry (fe80::1%lo0 localhost) for. 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost ...
17
votes
4answers
7k 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 ...
15
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 ...
15
votes
5answers
7k 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 ...
13
votes
2answers
6k 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 ...
11
votes
4answers
5k 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 ...
10
votes
5answers
11k 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 ...
9
votes
4answers
9k 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 ...
9
votes
1answer
1k views

Curl local host names on Mac OS X Yosemite

I just upgraded from Mavericks to Yosemite, and now curl can't see loopback host names. Set up a simple http server to test: $ python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... Now ...
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 ...
7
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 ...
7
votes
4answers
15k 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
5answers
3k 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 ...
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 ...
5
votes
2answers
8k 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 ...
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
453 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
4answers
17k 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 ...
4
votes
2answers
9k 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 ...
4
votes
1answer
4k 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
399 views

Personal /etc/hosts?

/etc/hosts lets you set system-wide hostname lookups. Is there a place in OS X to set per-user hostnames? I use two user accounts on my laptop and I'd like to override IP addresses for just one of ...
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
13k 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
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
6k 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
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
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 ...
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
4answers
2k views

Which leads to faster browsing, an ad blocker or an edited hosts file?

I recently came across the MVPS hosts file and became fascinated with the concept of blocking ads upstream from your browser. I don't know much about how quickly adblockers work, nor how quickly the ...
3
votes
3answers
786 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
2k 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
2k 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
385 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
4k 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
1k views

Hosts file resetting on Windows 7

Recently I've noticed my hosts file resetting itself. D:\Windows\System32\drivers\etc (OS installed on D drive) First time it reset it to the default, and now for the first time its completely ...
3
votes
1answer
92 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
2k 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
2answers
1k views

Hosts file changes are not recognized in Windows 8

When i make changes to the hosts file in windows 8, it doesn't work. Although my changes stay in the hosts file. What I'm trying to, is to redirect the domain name riddergarn.dev to 127.0.0.1 with ...
3
votes
1answer
569 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
4k 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
10k 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
2k 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
3answers
147 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 ...