hostname persistent – permanently without restart

Change hostname on Ubuntu without restart

To change the hostname permanently without a restart enter the following command:

hostnamectl set-hostname myhostname

To verify:
hostnamectl

  1. /etc/hostname contains name of the machine, as known to applications that run locally. /etc/hosts and DNS associate names with IP addresses. hostname may be mapped to whichever IP address the machine can access itself, but mapping it to 127.0.0.1.

/etc/hostname: CONTAINS myhostname

/etc/hosts: CONTAINS THE MAPPING:

127.0.0.1   localhost.localdomain   localhost myhostname
::1          localhost.localdomain   localhost myhostname

 

KEYWORDS

linux hostname permanently persistent

Schreibe einen Kommentar