Questions tagged [hosts-file]

The hosts file is a computer file used in an operating system to map hostnames to IP addresses. The hosts file is a plain text file and is conventionally named hosts.

The hosts file is one of several system facilities that assists in addressing network nodes in a computer network. It is a common part of an operating system's Internet Protocol (IP) implementation, and serves the function of translating human-friendly hostnames into numeric protocol addresses, called IP addresses, that identify and locate a host in an IP network.

In some operating systems, the hosts file's content is used preferentially to other methods, such as the Domain Name System (DNS), but many systems implement name service switches (e.g., nsswitch.conf for Linux and Unix) to provide customization. Unlike the DNS, the hosts file is under the direct control of the local computer's administrator.

More see at Wikipedia

134 questions
106
votes
8 answers

Does hosts file exist on the iPhone? How to change it?

I am developing an application that query to the server. In my Mac, I use the hosts file to change the dns to point to a local server within my local area network. Now I need to test it with my iPhone, the problem is that my iPhone does not…
Hoang Pham
  • 6,789
  • 11
  • 54
  • 69
97
votes
10 answers

Mac OSX Lion DNS lookup order

After upgrading to Mac OSX Lion I figured out that /etc/hosts is not looked up in first place for name resolution anymore. This leads to some side effects like: Entries in /etc/hosts are resolved painfully slow You can't not override existing…
Meik
  • 979
  • 1
  • 7
  • 3
47
votes
10 answers

Can't open local iis site in ie edge

I have a site set up locally to do development on it and I have added it to iis and edited my host file with the url (see below). However, when I browse to the url I only get the "hmm, we can't reach this page" message. The site works well in all…
Pete
  • 51,385
  • 23
  • 99
  • 140
47
votes
7 answers

ansible ssh prompt known_hosts issue

I'm running Ansible playbook and it works fine on one machine. On a new machine when I try for the first time, I get the following error. 17:04:34 PLAY [appservers] ************************************************************* 17:04:34 17:04:34…
AKS
  • 14,113
  • 34
  • 144
  • 227
34
votes
4 answers

How do I clear System.Net client DNS cache?

I'm using the .NET WebRequest while changing my HOSTS file. I'm observing that System.Net doesn't honor those changes - how can I make it do so? I have a number of servers load-balanced behind a single hostname, let's say 'example.com'. I want to…
Bruce
  • 7,460
  • 5
  • 34
  • 49
22
votes
6 answers

Why is Windows not reading my hosts file?

I'm having a hard time geting Windows to take into account a new entry in my hosts file. I tried adding this line: 199.229.249.151 models.db To the hosts file found here: c:\windows\system32\drivers\etc\hosts When I save the file and try to reach…
Almaron
  • 3,947
  • 4
  • 22
  • 45
20
votes
8 answers

How to find Google's IP address?

Google is blocked in some countries. However, there are many ways to access Google, like VPN, agent, and by changing the hosts file. If I want to change the hosts file to access Google, how can I find an available IP address? Update I can't access…
yorelog
  • 255
  • 1
  • 2
  • 6
18
votes
3 answers

iPhone: add entry to /etc/hosts without jailbreaking

For my development process I need to access a webserver which is behind a VPN and has no DNS entry. What I was doing on 4.x was to edit /etc/hosts on the iPhone, and add it to the hosts file. Now I'm on 5.0 beta, and don't want to jailbreak for now…
Cyrille
  • 24,430
  • 12
  • 61
  • 87
17
votes
1 answer

Can I temporarily override DNS resolution within a .NET application?

I have some wrapper code that runs a set of NUnit tests that scan live websites for certain response codes. I'd like to run these tests against a different server. When running manually, I can do this by editing the /etc/hosts file in…
Dylan Beattie
  • 50,029
  • 31
  • 120
  • 189
15
votes
2 answers

proxy_pass does not resolve DNS using /etc/hosts

In nginx the proxy_pass directive is not resolving DNS using the /etc/hosts file. Any way to enable this possibility (maybe by leveraging Lua as a last resort)?
Mark
  • 57,724
  • 41
  • 114
  • 149
15
votes
3 answers

Homestead 2.0 multiple sites, all link to the same url

Hee guys, little question: So i have setup the Homestead 2.0 and everything is working fine. I wanted to add another project in the same code directory but link it to another url. So i added it in the sites list but when i visited laravel.app it all…
bobbybouwmann
  • 883
  • 3
  • 12
  • 23
13
votes
2 answers

Best way to determine if a domain name would be a valid in a "hosts" file?

The Windows Hosts file allows you to associate an IP to a host name that has far greater freedom than a normal Internet domain name. I'd like to create a function that determines if a given name would be a valid "host" file domain name. Based on…
Jeff Moser
  • 18,820
  • 6
  • 58
  • 83
11
votes
3 answers

Android hosts file usage

I have the following problem: I make a custom hosts file to test some features of my application and then push it to my android emulator. The thing is that these settings do not take effect immediately. I have to wait about 10 minutes before they…
dominos
  • 412
  • 10
  • 20
10
votes
3 answers

Prevent Chrome from caching a site's DNS records

Chrome caches DNS records and tends to ignore changes to the hosts file after it has successfully connected to my site (barring a restart). With DNS pre-fetching enabled, it is even more pronounced. Are there any page headers that will instruct…
Petrus Theron
  • 25,051
  • 30
  • 137
  • 263
10
votes
2 answers

How are 127.0.0.1, 0.0.0.0 and localhost different?

I don't understand the difference between these terms and how they are connected. I looked at a hosts file on my computer and could see that 127.0.0.1 and localhost are connected but not sure how and I don't know where 0.0.0.0 fits into all…
j obe
  • 1,026
  • 2
  • 10
  • 17
1
2 3
8 9