Relevant files (slightly anonymized):
heinzi@d2:~$ cat /etc/hostname
d2
heinzi@d2:~$ cat /etc/hosts
127.0.0.1 localhost
<myexternalip> d2.<myname>.at <myname>.<myprovider>.at <myname>
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
This output is correct:
heinzi@d2:~$ hostname
d2
heinzi@d2:~$ hostname --all-fqdns
d2.<myname>.at
But this I don't understand:
heinzi@d2:~$ hostname --fqdn
<myprovider>.at
Shouldn't it be d2.<myname>.at, since that's the first entry after <myexternalip>? And if it's the second entry, shouldn't it by <myname>.<myprovider>.at instead of just the domain name?
I'm aware that I could probably fix this by playing around with the hosts file, but I'd really like to understand why this happens. I read the hostname man page and googled and think that it should return d2.<myname>.at in my case. Thus, I'd really prefer an answer along the lines of "This is because ..." instead of "Try ... and see if it works.".
The system is Debian 7.5 "wheezy".
NameorProviderin the names are useful. Hmm... maybe you meant replacing<myname>not byfoo, but byfooName? That's much better indeed.