I want to share a web page on a local network using a hostname. Is it necessary to change the host file of each PC?

  • 1
    Is it necessary to change the host file of each pc? Yes.
    – closetnoc
    Nov 2 '19 at 5:30
  • @closetnoc that is one way of doing it, but most routers also let you add DNS entries to your local network. I certainly wouldn't answer the question with just "yes". Nov 3 '19 at 20:35
  • @StephenOstermiller I was imaging the OP had a bunch of computers on a simple hub. If the OP is talking about using a router, then the answer would be more involved. By mentioning host names, I assume LAN only. Cheers!!
    – closetnoc
    Nov 4 '19 at 2:59

This depends on how your network is setup. If you have a central DNS server on your network (as many enterprise business networks have) then you can add a zone record for whatever domain you wish for it to show up as. If you don't currently have a central DNS server you could set one up to achieve what you are after just the same.

If both of those options are not available to you then you could use the standard network host name of the server you are using and it will allow you to show the web page through the default sit established (say 000-default for an apache server) by using the network name or IP address for the server in question.

If your desire is to have an actual domain name for the page, and you have no way to change the DNS zone file for the domain name in question then you would have to change the hosts file on every machine that will access the page in question but you need to be very careful with the hosts file as if you use an existing domain name then you will override DNS queries and prevent any access from the machines in question to the correct server for that hostname.

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.