hostname irritations vs. postfix entries

Hi,

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 'eidanswebbb.com', and my finctional Linode provided IP is 139.123.345.99 (IPv6 is omitted for now) my DNS entries are:

DNS Manager » gloabl.org

===================

SOA

====

(primary dns) –- (email)

ns1.linode.com --- admin@edianswebbb.com

NS

===

(nameserver) --- (subdomain)

ns1.linode.com --- eidanswebbb.com

ns2.linode.com --- eidanswebbb.com

ns3.linode.com --- eidanswebbb.com

ns4.linode.com --- eidanswebbb.com

ns5.linode.com --- eidanswebbb.com

MX

===

(mailserver) --- (preference)

mail.eidanswebbb.org --- 10

A/AAAA

======

(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, eidanwebbb.com www.eidanwebbb.com mail.eidanwebbb.com 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 www.eidanwebbb.com and mail.eidanwebbb.com. But maybe that confuses stuff for me for now.

Three files are involved:

/etc/hostname

=======

eidanwebbb.com

/etc/hosts

====

127.0.0.1 localhost alpha alpha.eidanwebbb

139.123.345.99 eidanwebbb.com www.eidanwebbb.com mail.eidanwebbb.com

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

myipv6address www.eidanweb.com mail.edianweb.com

/etc/host.conf

==========

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? alpha.eidanwebbb.com, mail.edianwebbb.com.

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.

Eidan

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 eidanwebbb.com

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

  • 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 eidanwebbb.com

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

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

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:

https://forum.linode.com/viewtopic.php?f=10&t=14690

https://forum.linode.com/viewtopic.php?f=19&t=14661

https://forum.linode.com/viewtopic.php?f=19&t=14598

Reply

Please enter an answer
Tips:

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] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct