Hostname for OpenVZ Containers - Question for Falko

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

  1. darinpeterson

    darinpeterson Member

    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:

    Code:
    echo server1.example.com > /etc/hostname
    /etc/init.d/hostname.sh start
    
    that both of these commands:

    Code:
    hostname
    hostname -f
    
    show "server1.example.com"

    With a virtual container in OpenVZ, it will only show "server1.example.com" immediately after running the commands. After reboot it the "hostname" command only shows "server1", however "hostname -f" shows "server1.example.com" 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?

    Thanks,
    Darin
     
  2. SamTzu

    SamTzu Active Member

    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

    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:

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

    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.

    Regards,
    Darin
     

Share This Page