Questions tagged [hosts]

A `hosts` file is used to map hostnames to IP addresses on a TCP/IP-enabled computer.

A hosts file is used to map hostnames to IP addresses on a TCP/IP-enabled computer. On Unix and Unix-like operating systems (Linux, OSX, FreeBSD, NetBSD, et al), the file is located at /etc/hosts. In Microsoft Windows, the file may be located in different places depending on the version of the operating system. In Plan 9 from Bell Labs it is located at /lib/ndb/hosts

On most systems, the behaviour of /etc/hosts depends on configuration within the /etc/nsswitch.conf file.

841 questions
5
votes
1 answer

.NET, Windows host file, dns override via code

I'm working on a project where we want to dynamically change the IP address of where requests are sent to within our app. So for example the first request we send to myWebsite.com goes to 192.168.123.1, the second we want to go to 192.168.123.5, the…
DavidReid
  • 449
  • 1
  • 5
  • 21
5
votes
1 answer

How do I use jdk.net.hosts.file and fallback to default NS resolution?

After I added -Djdk.net.hosts.file property my app cannot resolve the name of my local machine. Is there a way to make it fallback to default resolution when nothing found in the hosts file I provided?
guai
  • 780
  • 1
  • 12
  • 29
5
votes
0 answers

ADB push error: failed to copy: Not a directory

So I'm just trying to modify the hosts file on a family members phone. I've put the phone in debug mode and pulled the hosts file, edited it, but when I try to push it I get the message, "adb: error: failed to copy 'D:/hosts\hosts' to…
James
  • 51
  • 1
  • 3
5
votes
3 answers

What does [::1] mean in ALLOWED_HOSTS in Django?

I was going through the documentation for Django's ALLOWED_HOSTS here I came across a string ['localhost', '127.0.0.1', '[::1]'] in the ALLOWED_HOSTS. Everything looks fine except the '[::1]' part. I can't find a realtime scenario where '[::1]' is…
Underoos
  • 4,708
  • 8
  • 42
  • 85
5
votes
1 answer

vagrant /etc/hosts: machine IP vs localhost

I have a vagrant machine setup with this IP address: Vagrant.configure("2") do |config| config.vm.network :private_network, ip: 192.168.33.11 config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.hostname =…
numediaweb
  • 16,362
  • 12
  • 74
  • 110
5
votes
1 answer

Why does python's socket.getfqdn() return localhost.localdomain sometimes?

I don't quite understand what I'm seeing when I'm using socket.getfqdn() on my host. Here's what I'm seeing, then I'll explain it: [root@myawesomehost.iscool ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4…
Carrot
  • 195
  • 2
  • 9
5
votes
2 answers

Sync /etc/hosts file across multiple machines

Does anyone know an easy way to synchronize your /etc/hosts file across multiple machines? I use a MacBook, a MacMini, a Windows Machine as well as a Linux VM to develop websites with so it would be ideal to have all of them have the same hosts…
matsko
  • 21,895
  • 21
  • 102
  • 144
5
votes
3 answers

Forwarding only on a single port 8080 to localhost (windows) possible?

I know how to set up a local webserver using xampp on windows... I enter my alias and target on the hosts file (c:\windows\system32\drivers\etc\hosts) and then add a respective entry on my apache vhosts config file. This way, assuming that my…
Ben
  • 2,365
  • 4
  • 22
  • 29
5
votes
2 answers

How to add my container's hostname to /etc/hosts?

In order to support some old software solutions, I need to bind my container's hostname to 127.0.0.1, leaving me with something like this: $ hostname 4e84a7ae5f92 $ cat /etc/hosts | grep 127.0.0.1 127.0.0.1 localhost 4e84a7ae5f92 Best case…
Anto
  • 6,806
  • 8
  • 43
  • 65
5
votes
2 answers

What Windows 'hosts' encoding is?

What the Windows 'hosts' file encoding is? Is it UTF-8? Or ASCII + system codepage? How IDN (international domain names with umlauts etc.) entries should be added and can they be added at all?
noober
  • 4,819
  • 12
  • 49
  • 85
5
votes
3 answers

VirtualHost setup always doesn't work

I'm trying to set up a virtualHost for mampstack (NOT MAMP). This is what I've done so far: In my httpd.conf file I've checked Listen 8080 This is correct (I'm listening to the port 8080, NOT 80). Then I've uncommented: Include…
nielsv
  • 6,540
  • 35
  • 111
  • 215
5
votes
0 answers

UnknownHostException and /etc/hosts

I have records in /etc/hosts file which contains IPv4 and IPv6 addresses for host-name.com But I sometimes get UnknownHostException like: redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: host-name.com at…
valodzka
  • 5,535
  • 4
  • 39
  • 50
5
votes
3 answers

How can I solve 'Unable to find consistent port localhost' App Engine error?

I'm attempting to run Google App Engine just to get a hello world app up but have been failing. I'm on Windows 7 and have tried to use the GUI launcher as well as the Cygwin terminal. Having followed many different suggestions from SO forums…
uncleGe
  • 402
  • 4
  • 10
5
votes
5 answers

Including Port numbers in %systemroot%\system32\drivers\etc\hosts File

Is it possible to include port numbers in hosts file? Reason that I'm asking is because I have sites that I'm trying to migrate from one hosting server to another, and the sites are pointing to an old SQL server that uses the standard TCP/IP port…
mallows98
  • 1,529
  • 4
  • 22
  • 37
5
votes
5 answers

Why my script follows /etc/hosts but the browsers do not, when there is a SOCKS proxy?

My MacBook in office does not have internet access. So I set up an instant SOCKS Proxy over SSH to access stackoverflow. I mainly use my MacBook for development so I rely on /etc/hosts and virtual hosts to test some sites locally. However, when I…
ohho
  • 50,879
  • 75
  • 256
  • 383