/etc/sysconfig/network HOSTNAME Settings Home » CentOS » /etc/sysconfig/network HOSTNAME Settings September 4, 2016 Walter H. CentOS 4 Comments Hello, I found different ways to define the hostname … this HOSTNAME=”host.domain.tld” or this: HOSTNAME=”host” DOMAIN=”domain.tld” what is the correct way? Thanks, Walter
September 4, 2016 Walter H. CentOS 4 Comments Hello, I found different ways to define the hostname … this HOSTNAME=”host.domain.tld” or this: HOSTNAME=”host” DOMAIN=”domain.tld” what is the correct way? Thanks, Walter
Hello, I found different ways to define the hostname … this HOSTNAME=”host.domain.tld” or this: HOSTNAME=”host” DOMAIN=”domain.tld” what is the correct way? Thanks, Walter
In the case of RHEL 5 and 6 the former way is recommended[1]. I don’t know whether that advice has changed with RHEL 7. 1: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Network_Interfaces.html#sect-setting-the-host-name
That depends on what release you’re using. On CentOS 7, you’d use the “hostnamectl” command. The sysconfig/network file is no longer used for that purpose. Otherwise, consult /usr/share/doc/initscripts/sysconfig.txt
4 thoughts on - /etc/sysconfig/network HOSTNAME Settings
Hello,
I found different ways to define the hostname …
this HOSTNAME=”host.domain.tld”
or this:
HOSTNAME=”host”
DOMAIN=”domain.tld”
what is the correct way?
Thanks, Walter
In the case of RHEL 5 and 6 the former way is recommended[1]. I don’t know whether that advice has changed with RHEL 7.
1:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Network_Interfaces.html#sect-setting-the-host-name
hostnamectl set-hostname whateveryourhostnameshouldbe
That depends on what release you’re using. On CentOS 7, you’d use the
“hostnamectl” command. The sysconfig/network file is no longer used for that purpose.
Otherwise, consult /usr/share/doc/initscripts/sysconfig.txt