Hostname for OpenVZ Containers - Question for Falko

Discussion in 'HOWTO-Related Questions' started by darinpeterson, Apr 4, 2013.

  1. darinpeterson

    darinpeterson Member HowtoForge Supporter

    Hi Falko,

    In the tutorial The Perfect Server - Debian Squeeze (Debian 6.0) With BIND & Courier [ISPConfig 3], you state that it's important that it's important that after running these commands:

    echo > /etc/hostname
    /etc/init.d/ start
    that both of these commands:

    hostname -f
    show ""

    With a virtual container in OpenVZ, it will only show "" immediately after running the commands. After reboot it the "hostname" command only shows "server1", however "hostname -f" shows "" if the --hostname configuration is set in the container.

    Is there something that can be set in the container configuration so hostname will show the correct hostname?

  2. SamTzu

    SamTzu Member HowtoForge Supporter

    Only way is to enter the FQDN in the OpenVZ as the VM hostname or manually edit /etc/hostname file and to use chattr +i /etc/hostname.

    I recommend the first option.

    Normally /etc/hostname should not contain FQDN only the host name but this can be problematic on OpenVZ containers and you might have to manually modify on Postfix config's etc. and add the FQDN later.
    Last edited: Apr 4, 2013
  3. darinpeterson

    darinpeterson Member HowtoForge Supporter

    Hi SamTzu,

    Thank you for the reply.

    I have already set the hostname for the OpenVZ containers as the FQDN, if this is what you're talking about:

    vzctl set mail --hostname --save
    However, this does not solve the problem with the requirement that the command "hostname" producing "".

    If it's not required by ISPConfig, I would rather not change anything that might cause other issues.

    If the only reason Falko has asked that the hostname be the FQDN is the concern for a collision of names in ISPConfig, then that would be useful to know. If there are other implications, I would like to know.

    If you have more feedback, please provide it.


Share This Page