Podcast
Questions and Answers
What is the purpose of the /etc/hostname file?
What is the purpose of the /etc/hostname file?
- To store the network name of the machine
- To store the machine's IP address
- To store the DNS domain name labels
- To store the machine's hostname (correct)
What is the maximum length of the static hostname?
What is the maximum length of the static hostname?
- 128 characters
- 32 characters
- 64 characters (correct)
- 256 characters
What is the main difference between the static hostname and the pretty hostname?
What is the main difference between the static hostname and the pretty hostname?
- The static hostname is used for temporary configurations, while the pretty hostname is used for permanent configurations
- The static hostname is used for DNS domain name labels, while the pretty hostname is used for descriptive names (correct)
- The static hostname is used for IPv4, while the pretty hostname is used for IPv6
- The static hostname includes special characters, while the pretty hostname does not
What is the purpose of the hostnamectl command with the set-hostname sub-command?
What is the purpose of the hostnamectl command with the set-hostname sub-command?
What is the transient hostname used for?
What is the transient hostname used for?
Study Notes
Hostname Configuration
- The
hostnamectl
command can be used to set the hostname of a system. - If neither
--pretty
nor--transient
option is used, all three hostname types (static, pretty, and transient) will be set to the given name. - The
--static
option can be used to set the static hostname only. - The static hostname is stored in the
/etc/hostname
file.
hostnamectl Command
- The
hostnamectl
command can be used to display various descriptive and identity bits of information about the running system. - The
status
sub-command can be omitted, as it is the default action of thehostnamectl
command.
System Information
- The
hostnamectl
command can display the following information:- Static hostname
- Pretty hostname
- Transient hostname
- Icon name
- Chassis
- Machine ID
- Boot ID
- Operating System
- Kernel
- Architecture
Name Service Switch (NSS)
- The NSS configuration file is
/etc/nsswitch.conf
. - The NSS configuration file is used to determine the sources for name-IP matches and to obtain name-service information in a range of categories, called databases.
- The
hosts
database keeps track of the mapping between host names and host numbers.
Modifying Hostname
- The
hostnamectl
command can be used to modify the hostname of a system. - The
--static
option can be used to set the static hostname only. - The
--pretty
option can be used to set a more descriptive name for the machine.
/etc/hosts File
- The
/etc/hosts
file associates host names with IP addresses. - The format of the
/etc/hosts
file is:IP address hostname alias
.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Learn about configuring hostnames in Linux systems using the hostnamectl command. Understand the different options to set static, pretty, and transient hostnames.