Score:0

another machine in the LAN can connect to the apache web server with the ip address but not the hostname

pf flag

i have an apache web server setup and am trying to configure the hostname so that other machines in the same LAN network can connect using the hostname instead of the ip address. On the host machine I can access the apache web server using the ip address and the hostname. From another machine in the same LAN network i can access the web server using the ip address but not the hostname. How can I fix this?

Here are my files:

/etc/apache2/sites-available/000-default.conf

<VirtualHost *>
    DocumentRoot /var/www/html
    ServerName server100.net
    ServerAlias www.server100.net
    ServerAdmin webmaster@localhost
</VirtualHost>

/etc/hosts

127.0.0.1        localhost
127.0.1.1        home
199.163.65.10    server100.net    www.server100.net

The hosts machine is Ubuntu 22.04 LTS Virtual Machine and trying to connect from a Windows 10 Virtual Machine. If I need to give more information please let me know.

in flag
Does the Windows machine know to resolve server100.net to 199.163.65.10? Or was the `hosts` configuration only done on the Ubuntu server?
Score:0
in flag

Your router would have an option in DHCP setup called as Domain Name. This is used to resolve hostnames in a local network. You can run cat /etc/resolv.conf which would tell your search domain.

For e.g. if your search domain is local you can use <hostname>.local to access the machine over the local network.

Score:0
sd flag

You need to specify the hosts file on each of the clients so that is set for each.
Alternatively set up a DNS like BIND and set your Router to point to hand out this as DNS for your DHCP clients.
Your router might allow you to set this up there (machine name/IP) and make this work with a little less effort and learning. If you are running a server, then adding BIND is not the worst idea and lets you start filtering traffic across the whole LAN if you import a blacklist.

You also have the problem of do you own server100.net? you would need to keep all traffic to this site inside your LAN which again needs some local rules on DNS/router

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.