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.
There are options.
First is easy, but a little bad: just edit your
%windir%system32driversetchosts 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.