hostname irritations vs. postfix entries


So i'm running Debian 9 on one server that serves a website and is also used for email.

When it comes to setting up hosts, hostname, etc, I'm getting irritated by all the info out there specifically for setting it all up with the server itself, the ip address, the webserver, dns records, postfix, opendkim, etc.

I have read the Linode guides, and also other guides, but I'm getting consfused as they are all slightly different everytime. So my understanding (of my current setup is):

DNS points to the one single IP to all registered domains. So lets say I have a fictional domain called '', and my finctional Linode provided IP is 139.123.345.99 (IPv6 is omitted for now) my DNS entries are:

DNS Manager »




(primary dns) –- (email) ---



(nameserver) --- (subdomain) --- --- --- --- ---



(mailserver) --- (preference) --- 10



(hostname) --- (ipaddress)

--- 139.123.345.99

www --- 139.123.345.99

mail --- 139.123.345.99

I have the IPv6 parts too, but omitted from here for now. I have email specific spf, dmarc, adsp and dkip in the TXT part and nothing in the SRV part.

In my hosts file in /etc/hosts, I might have any or all of these in it: localhost, alpha, eidanwebbb, localhost.localdomain.

So what ones do I REALLY need? I also may want to separate my applications onto different servers at a later date too. So I might have more than one server, the email might run on it's own server, the webserver might be on another, so I might separate and But maybe that confuses stuff for me for now.

Three files are involved:




==== localhost alpha alpha.eidanwebbb


The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback alpha alpha.eidanweb

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters




multi on

So here are my thoughts attempts to answer my own questions:

Do I need localhost? yes, because the computer itself needs to have a sense of self

Can I have eidanwebbb or alpha? eidanwebbb to signify it's an external server of mine that I SSH into from my local laptop at home but also to help me know it's on the edianwebbb domain (whether it's .com or .net). Do I need alpha too? yes? because if i add another server and move email to it in the future it might be named 'bertie' and eidanwebbb and localhost. Does eidanwebbb become the domain then? So it's alpha.eidanwebbb localhost.eidanwebbb www.eidanwebbb, and mail.eidanwebbb… do i need to add the TLD to it?,

So alpha becomes a subdomain in the DNS way of looking.

What becomes my FQDN?

And now onto the nightmare that is Postfix… Actually, I'll leave that for now.

So I've written a lot here, and all I'm looking for is some basic pointers or guidelines.

Thanks a lot for reading, I look forward to the answers.


1 Reply

This is a basic overview. Some of this stuff you may already know.

/etc/hosts is for resolving names when the request comes from the local host (the computer you are logged into)

You're logged in to your linode over ssh / LISH and you type ping

  • /etc/host is used to work out the ip address of

  • If it doesn't exist in /etc/hosts, your linode may (depending on setup) then search the DNS.

DNS is for resolving names for computers external to your computer.

You're at home on your computer and you type ping

  • Your computers host file is used to work out the ip address of - doesn't find it and then

  • Your ISP's DNS is used to work out the IP address of

Essentially your linode will have only one hostname. Same as you only have one first name.

This host name will be part of one of your domains (if you have more than one)

Postfix will want the hostname and domain name of you server. This will also be in /etc/hosts.

These may help you out:


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct