Inconsistent Domain Names From hostname -f and domainname

domain-namedomain-name-system

I am setting up a Postfix mail server, hostname 'letters', to handle mail for the domain 'example.net'. I have tried to set letters' domain name to example.net using nis, but I'm getting inconsistent output from hostname -f ('letters.stuff.comcast.net') and domainname ('example.net') How do I set the domain name so hostname -f command to reports 'example.net'? Just how important is this to proper Postfix function?

The host letters is running Ubuntu and connects to the internet by cable modem to Comcast, through an openwrt router. The nameserver for the domain example.net is on a remote Debian computer, which hasn't yet been configured to create a host or an alias for letters.

I suppose that the domain name in the hostname output reflects the domain name obtained from the comcast server by the box's dhcp client, and reflects the idea that the box is a client on that network. Is the solution to create the 'letters' host on the name server for example.net? Does that further require adding that name server to those listed in letters' resolv.conf file?

Best Answer

Make sure your /etc/hosts (or NIS) entries are correct.

I was going to attempt to explain it, but the manpage tells the story better:

THE FQDN
    You can't change the FQDN (as returned by hostname --fqdn) or  the  DNS
    domain  name (as returned by dnsdomainname) with this command. The FQDN
    of the system is the name that the resolver(3)  returns  for  the  host
    name.

    [..]

    Therefore  it  depends on the configuration (usually in /etc/host.conf)
    how you can change it. Usually (if the hosts file is parsed before  DNS
    or NIS) you can change it in /etc/hosts.
Related Topic