Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My basic question is not "why doesn't this work?", but "why DOES this work?".

I have a computer running apache 2.2 under windows, with the ServerName set to something like gateway_01. It's connected to the office wifi, on a netgear router. I set it up naively, without configuring anything else, and it seemed to work.

But it doesn't work consistently. As far as I can tell from googling, to be sure that I can access it using http://gateway_01 over the local network, I need to:

  • Give it a static IP address
  • Run a local DNS server that knows that http://gateway_01 corresponds to 192.168.1.whatever (or modify the hosts file on my computer, but it wouldn't be feasible to do that for every computer on the network, including random guests and people's phones).
  • Set my router to use the local DNS server when computers connect via DHCP

I haven't actually done any of that. Sometimes I can reach gateway_01 perfectly fine, and sometimes I need to use the IP address.

Why is this, and can I set things up to work reliably without having to run a local DNS server? I have a sneaking suspicion it's something to do with windows, workgroups and the fact that the computer's name is the same as the ServerName, but I'd quite like to know for sure what's actually going on.

share|improve this question
Are you running Samba on your server? If so then your Windows clients might be able to resolve its name by broadcasting for it, or querying your WINS server. – Flup May 14 '13 at 15:31
What Flup said. If you want reliability setup a local DNS server. If your clients are already in a domain then add the web server name and IP to it. Or create a host file for every machine, which is doable but a PITA to administer. – Jason H May 14 '13 at 15:32
FYI. You shouldn't be using _ in your computer names. That isn't a permitted character in DNS records. Or at least it isn't permitted in the type of records you need to make a server web visible on the Internets. See: – Zoredache May 14 '13 at 18:58
up vote 2 down vote accepted

Considering you're running Apache on Windows, it sounds to me like you're using NBT (NetBIOS over TCP) to resolve the hostname. Your suspicion is probably correct; this is in the same vein as Windows Workgroups, and is notoriously unreliable for a variety of reasons. Take a look here and here if you really want to dive in to it...

You're definitely better off setting up local DNS or using the hosts file to resolve this issue.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .