Tabela de Conteúdos

2.1.3 Hostname

Objective

After the instalaltion, the hostname can be changed.

Configuration

The system name or hostname, is stored in the configuration file /etc/hostname. This file shall contain only the hostname, not the fully qualified domain name. To permanently change the name of th system, just edit the file:

/etc/hostname
server

Now, we need to activate the new name:

root@server:~# hostname -F /etc/hostname

Then, the new name must be associated with the IP address and the fully qualified domain name of our system. This associations ae stor4d in the configuration file /etc/hosts:

/etc/hosts
127.0.0.1       localhost
192.168.1.100   server.home.lan server

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Verification

root@server:~# hostname --short
server
root@server:~# hostname --domain
home.lan
root@server:~# hostname --fqdn
server.home.lan
root@server:~# hostname --ip-address
192.168.1.100

References