Pour ceux qui galèrent avec leur hostname en FQDN, voici le tuto à suivre :
Getting the FQDN to work properly can be a b*tch. 😉
Basically, for the FQDN resolution to work correctly, three (or four)
things need to play together. That’s the files /etc/hostname,
/etc/hosts, /etc/resolv.conf and your external nameserver (provided by
your hoster e.g.).
Let’s say your server’s hostname is “lyra” and its already
established and externally resolvable domain name is “tianet.de”. Let’s
further say that lyra’s IP is 18.104.22.168, and the nameserver that
forwards requests to the outside has the IP 22.214.171.124 (real-life
example from my experimental Virtualmin VM).
Then the contents need to be as follows:
/etc/hosts127.0.0.1 localhost 126.96.36.199 lyra.tianet.de lyra
(Note that I have both the FQDN and the standalone hostname there.)
/etc/resolv.confnameserver 188.8.131.52 domain tianet.de
After setting these contents, it might be helpful/required to reboot the machine or execute
/etc/init.d/networking restart, though usually that’s not necessary.
hostnameshould then reply with “lyra”, and
hostname -fwith “lyra.tianet.de”.
If you still have trouble then, you can additionally check the file
/etc/nsswitch.confwhich tells the system which facilities to consult for resolving various stuff. You should have a line like this there:hosts: files dns
If it’s missing or deviating, edit it to this.