About
A hostname is a DNS name for a host (ie for the operating system) that is composed of:
- a label (generally called the short name)
- and a domain
The hostname or computer name:
- is a logical name for the host itself
- is set in the operating system (used to initialize the OS kernel hostname)
- is unique for the host (but it may have several logical name called IP name)
The operating system knows its own host under its host name.
Hostname vs IP Name
A hostname is not an IP name because a host:
- can have several IP names by IP address
- but have only one host name.
If the relevant host only has one network adapter, the host name and the IP name are normally identical. In this case, there is a unique relationship between the logical host name and the IP name. This means that this host can be addressed by other computers using its host name.
Virtual
A Hostname may be virtual meaning that a service hosted on a system with:
- the hostname foo can answer a request
- for the virtual hostname bar.
This is used for instance to host several web server. See What is and how works a virtual host / custom domain / vanity hostnames
Value
Long
The value of the hostname is a full qualified format.
hostname
myname.example.com
Short
But you can query also the relative format.
hostname -s
myname
Type
Static
The static hostname is the hostname that is defined on the host itself (generally in a file).
Linux: it is configured in the /etc/hostname file.
If the static hostname is not set, the transient hostname is the default one.
Transient
The Transient hostname represents the name that is set by network configuration such as:
- HostFile
- DHCP
- or DNS
after a system boot.
If the Transient hostname is not set, the system uses the Static hostname.
Management
Query
You can query the hostname under UNIX or Windows by using the command hostname. Linux - Hostname (Kernel, Static)
Default
If a static hostname is not set, the default hostname is the one defined by the network configuration and is also known as transient hostname
Set
The hostname that is set is called the static hostname.
If not set, the hostname of the network configuration is taken, see default
The hostname should be set with a full qualified format.
To set it on linux, see Linux - Hostname (Kernel, Static)
Documentation / Reference
- See also the DNS definition