0

At a fresh new install of Ubuntu, what should I set as hostname?

I'm trying to set a mail server at my local servers with Ubuntu/Postfix, but I'm facing some issues along the way. For this, while checking some references, I've notice some authors mentioning that hostname should have FQDN (mailer.xyz.com) instead of VM name (mailer).

At Ubuntu 22.04 installation process, I do inform name servers = 9.9.9.9 and search domains = xyz.com,company.com and I do get VM name (mailer) as initial hostname.

rd1218
  • 151

2 Answers2

3

It doesn't matter. What matters is that the hostname used in ehlo has matching forward and reverse DNS names.

vidarlo
  • 9,165
0

Too long for another comment:

The Setting the hostname: FQDN or short name? Q&A suggests that despite the fact that there are a lot of different opinions, there is neither consensus nor a real technical reason for Linux systems to prefer setting a short hostname on the host over a setting FQDN or vice-versa. Do what you like, as long as you're consistent.

As to selecting what hostname your mail server, postfix, must use ; that has much more stringent requirements WHEN you want to get your mail delivered.

As already answered the postfix myhostname setting MUST be a FQDN.

By default Postfix tries to derive that myhostname FQDN from the system hostname (and can deal with the system hostname being either a short name or a FQDN) but myhostname can also be set explicitly and be different from the system hostname. That may be preferred when you don't want to deviate from your naming convention for the host that will be assigned the mail server role.

  # Postfix main.cf

... myhostname = host.example.com ...

For reliable delivery that postfix myhostname FQDN MUST exist. The FQDN MUST point to the IPv4 and/or IPv6 address(es) postfix uses for sending outbound SMTP mail AND the reverse DNS records, PTR records, for the IPv4 and/or IPv6 address(es) postfix uses MUST align.

In other words when your mail server is configured with IPv4 address 10.9.8.7 and IPv6 address 2001:DB8::202 then in DNS :

host.example.com.  IN A    10.9.8.7 
host.example.com   IN AAAA 2001:DB8::202

then the reverse DNS records must exist and align:

7.8.9.10.in-addr.arpa.      IN  PTR host.example.com.
2.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. IN PTR  host.example.com.
HBruijn
  • 80,330
  • 24
  • 138
  • 209