What's new

How is hostname determined?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

CharlieD

New Around Here
How is the hostname determined that we see in the network map and the traffic monitor? Here's why I ask.

My main Linux server (fedora 19) is connected to one of the wired ports and has a static IP address. The hostname is oak. Sometimes the network map would show this name and sometimes it only showed the MAC address.

Recently I installed the Plex Media Server (http://plex.tv). Now the hostname shows up as Plex Media Serv (yes, that's as long as it is). The hostname command on the server still returns the original hostame - oak - and /etc/hosts has not changed. So, where is the router getting the hostname from?

--Charlie
 
What comes out when you enter hostname in your Linux terminal?
Code:
# hostname
Hostname is stored in /etc/hostname
If you change it reboot and it will be active.
 
Last edited:
As I noted above, the hostname command still returns oak. /etc/hostname still has oak as does /etc/hosts.
 
Do you have apache or any other webserver running apart from Plesk?
Apache's ServerName directive might enforce it.
 
How is the hostname determined that we see in the network map and the traffic monitor? Here's why I ask.

My main Linux server (fedora 19) is connected to one of the wired ports and has a static IP address. The hostname is oak. Sometimes the network map would show this name and sometimes it only showed the MAC address.

Recently I installed the Plex Media Server (http://plex.tv). Now the hostname shows up as Plex Media Serv (yes, that's as long as it is). The hostname command on the server still returns the original hostame - oak - and /etc/hosts has not changed. So, where is the router getting the hostname from?

--Charlie

Here's the order used to determine a device's name on the Networkmap, with the highest priority at the top:

- If a name is defined on the DHCP reservation page, that name is used
- Otherwise, if the client provided its hostname while requesting a lease,
- Otherwise, if the device returns a name when doing a Netbios lookup (those usually show up in uppercase)
 
Here's the order used to determine a device's name on the Networkmap, with the highest priority at the top:

- If a name is defined on the DHCP reservation page, that name is used
- Otherwise, if the client provided its hostname while requesting a lease,
- Otherwise, if the device returns a name when doing a Netbios lookup (those usually show up in uppercase)

Server has a static IP address. No DHCP so the first two do not apply. Server is Linux. netbios is a Windows thing, right (sorry, I'm a Linux/UNIX admin in real life. Windows is not my forte.) However, it does run Samba but I have not touched that in ages. Actually. netbios name in smb.conf is commented out. I do run a web server. ServerName is www.dennett.org.
 
Even though I have specified the router to be the WINS server, the names don't show up until the client renews it's lease.

Back on my old router with Tomato firmware, I was able to work around this by adding dchp-host=<mac address>,<name> entries into the dnsmasq.config. I have this in place with a dnsmasq.conf.add, but it doesn't seem to work on this firmware.
 
Server has a static IP address. No DHCP so the first two do not apply. Server is Linux. netbios is a Windows thing, right (sorry, I'm a Linux/UNIX admin in real life. Windows is not my forte.) However, it does run Samba but I have not touched that in ages. Actually. netbios name in smb.conf is commented out. I do run a web server. ServerName is www.dennett.org.

Netbios also applies to Samba. Any SMB device will have a Netbios name associated to it.

Note that even if the server uses a static IP, a DHCP reservation the router with a matching MAC will still be used by Networkmap for name resolution.
 
I have this in place with a dnsmasq.conf.add, but it doesn't seem to work on this firmware.
I have just done a couple of tests. I use dnsmasq to resolve my internal testservers which I have given .dev and .test "TLDs" (CentOS Servers).
This works great with entries in /jffs/configs/dnsmasq.conf.add as follows:
Code:
address=/dev/<ip-address>
address=/test/<ip-address>
Now I can use domain.dev or anotherdomain.test and it will resolve to the correct Testserver.
However, if I ping 'dev' it will not resolve. They will, however resolve to <mycompanyname>.dev as that is their hostname. Thats not a problem for my environment but now I was curious as to why 'dev' is not resolved. I have changed the /dev/ part to the following and pinged:
ping dev --> no resolve as mentioned above
ping centos-dev --> no resolve
ping whatever.dev --> resolved, as expected

Conclusion is that address=/dev/<ip-address> is resolved as either a tld (dev) or a domain name (whatever.dev).
So you could name your devices with names separated by a . (dot) eg oak.lan or oak.local and you'd have a valid hostname for your LAN.

For CharlieD's www.dennett.org you could add address=/dennett.org/<ip-address> to resolve to your server internally. If you want to do so (I see your also into SETI. I cruch for SETI, LHC and others as well... since about 1999)
 
If Networkmap resolution is what you are after, then enter them on the DHCP reservation list. Even if your clients are using a static IP, it will still be used by Networkmap for name resolutions.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top