Renaming a Node -- support for period (.) in node name?

briceburg

New Member
Sep 26, 2012
19
0
1
We have adopted a DNS naming scheme of:

<location>.<server-role>.domain.net

e.g.
chicago-1.app-1.domain.net

The location prefix easily allows me to sort our DNS records, and allows people to know WHERE/what server they're accessing.

Thus I wanted to name our latest nodes (as part of a 3 node proxmox cluster) as:

tn.hyper-1.domain.net
tn.hyper-2.domain.net
tn.hyper-3.domain.net

When I installed proxmox I chose tn.hyper-#.domain.net as the domain name. When the machine boots it thinks it's hostname is "tn". Is there a way I can force the proper hostname (should be tn.hyper-1, tn.hyper-2, tn.hyper-3 accordingly).

Thanks for the input!

~ Brice
 
You know as per specification of DNS a dot (".") cannot be included in the host part - maybe you should modify your naming scheme to be 'DNS compatible'
 
Last edited:
According to `man hosts`, "Host names may contain only alphanumeric characters, minus signs ("-"), and periods (".")". I've successfully used hostnames with dots in them without problem for awhile now. It has been much less successful in proxmox / openvz where scripts seem to fudge things up.

When manually bootstrapping hosts I do:

[Debian/Ubuntu]
echo $hostname > /etc/hostname
hostname -F /etc/hostname

# set bash $PS1 prompt to use full hostname (e.g. "chi.db-1" vs. "chi" )
sed -i 's/\\u@\\h/\\u@\\H/g' /etc/bash.bashrc

# and the first line of /etc/hosts looks like:
127.0.0.1 localhost $fqdn $hostname

===

[RHEL/CentOS]

# set hostname in /etc/sysconfig/network
HOSTNAME=$hostname

# execute hostname command
hostname $hostname

# set bash $PS1 prompt to use full hostname (e.g. "chi.db-1" vs. "chi" )
sed -i 's/\\u@\\h/\\u@\\H/g' /etc/bashrc

# and the first line of /etc/hosts looks like:
127.0.0.1 localhost $fqdn $hostname

===

Has anyone else successfully accomplished hostnames with a dot in OpenVZ / Proxmox? I guess I could use tn-<server-role> but would like to stick w/ our existing naming scheme.
 
Also -- if the unanimous decision is that NO; proxmox cannot handle a node name with a dot -- is there a method for RENAMING a node?

Thanks!
 
You are referring to 'hostname' in the man pages which is a FQDN that contains dots but the 'host part' of a FQDN is only the name before the first dot;

see the RFC's for DNS;
 
to be more specific:

/etc/hosts may contain hostnames with and without dots where you need to differentiate between FQDN, domain and host part;
/etc/hostname can only contain the host part without the domain part;