The hostname for your server is for the purpose of IP resolution local to your Pi. The router won't recognize it automatically.
The network protocol which is used for network communication does not use domain/host names, just MAC addresses - the former are mostly for the convenience of us humans.
Unless you have a router that actively queries hostnames from the machines set up on your LAN (haven't seen such a thing myself), your router recognizes devices by their MACs.
Your best bet is to simply:
- Set up a static IP for your Pi's MAC (if you haven't already).
- Set up the virtual host port forwarding to your Pi directly on your router (most should handle that, so that you don't need to use your other machine for this purpose).
You could set up a DNS server on your Pi, such as bind9
, which would map your hostname to your IP address, but that requires a lot of configuration, and would only work on the computers that recognize that DNS server anyway (so computers/servers that you have specifically set up for this).
If you want to refer to your Pi using it's hostname from your desktop/laptop, add the hostname/IP number pair to your computer's hosts file.