Skip to content

Choosing the right hostname

Definition

A machine's hostname/nodename is a sequence of 1 to 63 ASCII characters which can only be letters, numbers and the optional hyphen-minus character ('-'). However, the latter is not permitted to be used as first or last character.

The hostname is primarily used to identify the machine and determine it's IP address in a local or wide area network by leveraging DNS.

Tips and tricks

When it comes to choosing a hostname for a machine it is important to not create one that is too long. Just because they can be 63 characters long doesn't mean they have to be, rather make them as memorable as possible.

RFC 1178 gives a good explanation on what to and not do when choosing a hostname for your machine.

Tips worth pointing out are:

Don'ts
  • Long names (longer than 8 characters)
  • Using terms commonly used
  • Giving a name unique to the current project
  • Alternate spellings
  • Using domain names
  • Digits at the beginning of the name
  • Non-alphanumeric characters
  • Random strings
Dos
  • Short names (no longer than 12 characters)
  • Using unique real words/names
  • Using names from the same theme
Exceptions

A potential exception could come to be when spinning up VMs on a host. For example, a hypervisor's hostname is stillsuit and it contains multiple VMs. The VMs' hostnames in turn would resemble something similar to stillsuit-vm01, stillsuit-vm02, stillsuit-vm03 and so on.

Example

In this example the name will be based on the 'Dune' movie theme.

Theme:              Dune (Movie)
Theme-based name:   Sandworm
Hostname:           sandworm
Domain:             example.com
FQDN:               sandworm.example.com

Info

It's worth noting that generative AI applications can be leveraged to create a theme based list of names.