[Users] Hostname issue on CentOS 7.x

Jean-Pierre Abboud jpabboud at gotekky.com
Mon Nov 14 12:31:02 PST 2016


hostname -f shows the correct hostname, however CentOS 7.x running on KVM is showing FQDN even using the regular hostname command without the -f switch. cPanel also reported the same thing when I asked support.

--
Jean-Pierre Abboud
Account Manager / Gotekky
888.915.4400 / 514.316.1885
Email: jpabboud at gotekky.com

> On Nov 11, 2016, at 2:13 AM, Kir Kolyshkin <kir at virtuozzo.com> wrote:
> 
> 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
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://lists.openvz.org/mailman/listinfo/users




More information about the Users mailing list