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
10
votes
1 answer

/etc/hosts ignored in mac El Capitan (10.11.5)

I'm attempting to redirect an existing web address to a remote machine on my subnet. To do that, I put the following into /etc/hosts 192.168.1.249 holub.com and flush the DNS cache with sudo dscacheutil -flushcache;sudo killall -HUP…
aholub
  • 293
  • 3
  • 10
9
votes
6 answers

How do i change the hosts file in a windows program?

How would a program in C++/ C / C# program change the C:\Windows\System32\drivers\etc\hosts file content in windows? I know this sounds like phishing, honestly not.
JRDH
  • 107
  • 1
  • 1
  • 2
8
votes
3 answers

How can I programmatically edit the hosts file in Windows 7/Server 2008?

I'm writing a little WPF utility to manage entries in the hosts file for dev purposes. As you might know the hosts file is protected by the newer OSs (Win 7/2008/Vista). I've added a manifest to my application to set the requestedExecutionLevel to…
bszom
  • 1,005
  • 2
  • 13
  • 22
8
votes
2 answers

How to force Apache Bench to use IP addresses specified in /etc/hosts?

I'm using ApacheBench to do some load testing. I'd like ab to resolve the hostname using the IP address specified in /etc/hosts on my Mac. How can I force that? curl has a --resolve option to do exactly this, as specified here. I'm looking for…
tinkerr
  • 801
  • 1
  • 11
  • 30
6
votes
1 answer

Mac OS X ignoring hosts file

Mac seems to be ignoring new changes to my hosts file. Older changes work without a problem. I've spent the past 4 hours trying to figure this one out. Help! I have folders for each site that I develop in my /Sites folder. For example, several…
chris_mac
  • 921
  • 3
  • 10
  • 21
6
votes
2 answers

MacOS hosts file entry for only non-www url

I'm running MacOSX 10.11.4. I'd like to have example.com point to my locally running apache server, but have www.example.com point to the actual website. Example: I have the following entry in my /etc/hosts file: 127.0.0.1 example.com If I ping…
Jason
  • 546
  • 1
  • 5
  • 21
5
votes
4 answers

Wordpress url shows page not found on localhost, but online its fine

I have installed wordpress, now the http://localhost/wp-login.php and the likes are okay. Assuming that I want to go to a page such such as http://localhost/something-here/ gives me a 404 error. This 404 error happens only on localhost not on a…
X10nD
  • 19,972
  • 44
  • 105
  • 150
4
votes
1 answer

Adding Apache VirtualHost, DocumentRoot of localhost changes to the VirtualHost's DocumentRoot

Everything is working perfectly in my Windows 7. The problem is when I add a domain1.com as VirtualHost, localhost's DocumentRoot changes to VirtualHost's DocumentRoot. Eg: When I visit http://localhost, DocumentRoot which I specified for…
Jigar D
  • 83
  • 1
  • 2
  • 5
4
votes
2 answers

IOError: 13, 'Permission denied' when writing to /etc/hosts via Python

I have a Python app that I'm working on that needs to access the hosts file to append a few lines. Everything worked on my test file, but when I told the program to actually modify my hosts file in /etc/hosts I get IOError 13. From what I…
Parker
  • 7,943
  • 7
  • 60
  • 91
4
votes
2 answers

Spark submit application master host

I'm a newbie to Spark and I encountered an issue while submitting an application. I setup a master node with two slaves with spark, a single node with zookeeper, and a single node with kafka. I wanted to launch a modified version of the kafka…
se7entyse7en
  • 3,592
  • 4
  • 26
  • 42
4
votes
3 answers

Debugging why I get "You don't have permission to access" in Apache 2.4

I am trying to create a local environment in Linux/Ubuntu. I have install Apache 2.4.7 (using apt-get). I have changed my /etc/hosts to this: 127.0.0.1 example.dev 127.0.0.1 localhost ... I also added a file "example.dev.conf" to…
Yahya Uddin
  • 18,489
  • 26
  • 104
  • 189
4
votes
1 answer

How to set up a local DNS server in python

I am using windows 7 and python 2.7 I want to map 172.16.45.84 IP address to myapp.nobies.in without mapping in hosts file. I have the required certificate to this hostname. I don't want to map in hosts file as it requires administrative…
imp
  • 1,575
  • 1
  • 24
  • 38
4
votes
2 answers

blocking website via hosts file not working?

I'm trying to block a website using the hosts file using this tutorial : http://hackspc.com/how-to-block-a-website/ but It doesn't work, the website I'v blocked In this case facebook still shows up, please can anyone help me out here?
Parastar
  • 677
  • 2
  • 7
  • 5
3
votes
2 answers

DNS resolving based on client IP

I want to configure bind/write driver that resolves DNS requests based on the ip address of the client. We want to unify the domain names of all test environments for our web application. Instead of having many domains like test.mysite.com,…
devdimi
  • 2,384
  • 18
  • 18
3
votes
1 answer

Hosts file ANTLR grammar

Is there an existing, working hosts file grammar on the web? I checked out list on http://www.antlr.org/grammar/list, but I didn't find it there. I also checked the hosts file entry in Wikipedia, and it referenced RFC 952, but I don't think that is…
Merlyn Morgan-Graham
  • 54,918
  • 14
  • 119
  • 174
1
2
3
8 9