2

I currently have a few cloud instances and each of them has it's own URL (such as example.com) that is pointed at it through my registrar.

However, I am curious what, if any changes I should make to their hostname (using the hostname) command to configure them properly.

Just for fun, I have given them totally random names, through either the hostname command or by editing /etc/hostname.

The thing is, I just don't know what this is used for?

Can anyone clarify how the hostname set on the server relates to the URL / domain name I am pointing at it (if it does at all) and for what, exactly, the hostname of a server is used?

  • For disposable cloud instances, random hostnames are fine. Their main purpose is for administrators to easily identify systems. This isn't as applicable for cloud systems which are usually grouped by role in the cloud provider's UI. – jordanm Dec 3 '16 at 2:08
3

[...] own URL (such as example.com) that is pointed at it through my registrar.

That's not what a (domain) registrar does. A domain registrar just acts as your proxy for registering your domain, its contact information, and its delegated DNS servers in the domain registry. After that, it's up to the DNS servers what the names under that domain point to.

You may be using a service provider that supplies both registrar services and DNS services, but it's important to distinguish the functions.

The thing is, I just don't know what this is used for?

This is used so you can tell them apart. That's why we give names to things in general.

Can anyone clarify how the hostname set on the server relates to the URL / domain name I am pointing at it (if it does at all)

Depending on your web server, the system hostname may be used as the default value of the ServerName (or equivalent), that is, the server's own idea of its host name. That information may be revealed in such things as HTTP redirects automatically generated by the web server.

for what, exactly, the hostname of a server is used

Many things, really: it may go in default shell prompts (so you can see what machine you're connected to), in log files, DNS PTR records, and so on.

  • So the take away, in reading your answer, is that it is not (usually) used for anything completely critical. I can change it without worrying that I am going to break something in DNS? – Startec Dec 3 '16 at 10:29
  • 1
    Sure, though for your own sanity it should probably match what you have in DNS, especially if you manage a lot of machines. If you ssh into "machine1" and the prompt is "machine3" and/or you start to want to copy configuration files around between your machines, or understand which machine you colleague is talking about when they try to tell you they ran into a problem on machine so-and-so, then, you'll probably want some consistency in your names! – Celada Dec 3 '16 at 12:33
1

SMTP might be problematical with a random hostname, depending on the Mail Transport Agent, if that invalid or does-not-exist hostname gets into the HELO or EHLO request and then that connection is shot down on account of that bad hostname by the remote server.

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.