1

I have Apache2 running on one of my linux machines, and I often use it to browse a local website on that machine from other machines on my home network.

But I can only do so by accessing the server by IP address.

I would like to be able to access via hostname, or some other arbitrary, memorable string, but I can't figure out how to do this. My Netgear router has a section that lists MAC addresses, corresponding IP addresses (assigned by the router through DHCP) and a user-configurable device name. I thought this would map between the device name and IP address, but it doesn't; all attempts to load a webpage using the device name fail, although the page loads just fine if I provide the IP address directly.

How do I make this happen? I'm running Linux on the server machine.

1

There are options.

First is easy, but a little bad: just edit your /etc/hosts (%windir%\system32\drivers\etc\hosts on Windows) on every client machine and add required ip-address to domain name mapping.

The second option is to utilize your router's DNS server. I can't say if your device have it or not, but some of soho routers have a simple implementation of DNS server. Refer to user manual and, if yes, check network settings on your client machines to ensure their primary DNS server is your router.

The third option is to have a standalone DNS server, say, on the same machine (it could be any other machine, or NAS, or RPi, or anything else you are able to install required software). It's not too hard and there's a lot of manuals on the Internet how to do this. Next you have to point your clients to it and then it should always be online.

  • Yeah, I was hoping to avoid the hosts file approach. Sadly, my router doesn't seem to provide a DNS server. And setting up my own nameserver just seems fraught with difficulty; it's not the sort of thing I really wanted to spend a week or more hammering on. But thanks. – SixDegrees Jan 11 '15 at 20:58
  • I wonder if there could have some way to do that on android for vnc, I think it will be a cool question at android s.e – Aquarius Power Aug 17 '16 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.