[Users] Hostname issue on CentOS 7.x

Kir Kolyshkin kir at virtuozzo.com
Thu Nov 10 23:13:37 PST 2016


On 11/10/2016 08:33 PM, Jean-Pierre Abboud wrote:
> Hello everyone,
>
> We’re facing an issue on many CentOS 7.x containers running cPanel. Clients are getting emails saying that the hostnames are not valid, for example it will show server1   instead of the fully qualified domain name server1.domain.com
>
> I have tried changing the hostname via cPanel or even manually but after rebooting it goes back to server1
>
> The container’s openvz config does contain the appropriate HOSTNAME line
> HOSTNAME=“server1.domain.com"
>
> [root at server1 network-scripts]# cat /etc/hosts
> 127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4
> # Auto-generated hostname. Please do not remove this comment.
> 104.245.200.10 server1.domain.com localhost6 localhost6.localdomain6  server1 localhost.localdomain
> ::1             localhost
>
> [root at server1 network-scripts]# cat /etc/hostname
> server1
>
> [root at server1 network-scripts]# cat /proc/sys/kernel/hostname
> server1
>
> [root at server1 network-scripts]# cat /etc/sysconfig/network
> NETWORKING="yes"
> GATEWAYDEV="venet0"
> NETWORKING_IPV6="yes"
> IPV6_DEFAULTDEV="venet0"
> HOSTNAME=server1.domain.com
> DOMAINNAME=domain.com
>
> [root at server1 network-scripts]# cat /etc/redhat-release
> CentOS Linux release 7.2.1511 (Core)
>
> Please note that I replaced the client’s domain and IP for privacy reasons.

It looks like a correct behaviour to me, since hostname(5)
man page says that hostname should not contain dots,
i.e. not be FQDN, so vzctl strips the domain name out of it.

What does "hostname -f" shows? Note -f flag means FQDN
("fully qualified domain name", i.e. with domain).

Kir


More information about the Users mailing list