Postfix connected on right IP address comes back with wrong server name

SYSTEM INFORMATION
OS type and version Ubuntu Linux 24.04.5
Virtualmin version 8.3.0 GPL
Webmin version 2.670
Usermin version 2.570
Authentic theme version 26.70
Kernel and CPU Linux 6.8.0-139-generic on x86_64
Processor information 12th Gen Intel(R) Core™ i5-12500, 12 cores

Since my last posts, I’m still having some weird issues.
Everything is working, not a real problem, but…

For some reason my postfix comes back with the first server name, and not the domain name when accessing it.

For example:
And I hope this makes sense.

  • Ip addresses and names changed for privacy perposes.
Transcript: Connecting to 192.168.171.222
Transcript:
Transcript: 220 linux2.my.firstdomain ESMTP Postfix (Ubuntu) [240 ms]
Transcript: EHLO keeper-us-east-1d.mxtoolbox.com
Transcript: 250-linux2.my.firstdomain
Transcript: 250-PIPELINING
Transcript: 250-SIZE 10240000
Transcript: 250-VRFY
Transcript: 250-ETRN
Transcript: 250-STARTTLS
Transcript: 250-AUTH PLAIN LOGIN
Transcript: 250-AUTH=PLAIN LOGIN
Transcript: 250-ENHANCEDSTATUSCODES
Transcript: 250-8BITMIME
Transcript: 250-DSN
Transcript: 250-SMTPUTF8
Transcript: 250 CHUNKING [223 ms]
Transcript: MAIL FROM:<supertool@mxtoolboxsmtpdiag.com>
Transcript: 250 2.1.0 Ok [226 ms]
Transcript: RCPT TO:<test@mxtoolboxsmtpdiag.com>
Transcript: 454 4.7.1 <test@mxtoolboxsmtpdiag.com>: Relay access denied [224 ms]
Transcript:
Transcript:
Transcript: - LookupServer [smtp:mail.my.correctdomain] 1522ms
Transcript:

192.168.171.222 = the correct IP addres for my.correctdomain
my.firstdomain = the main server domain (IP 192.168.171.220)
my.correctdomain = the domain it should be

When sending mail it comes withe a certificate problem because it also comes back with the linux2.my.firstdomain certificate.

Even the domains hosted on the 129.168.171.221 Address comes back with this server.

The main server (first address; linux2.my.firstdomain) is 129.168.171.220.

I hope this make sese to anyone, because It doesn’t to me -lol-

Again, everything seems to be working as it supposed to do,
but some things aren’t working smoothly in the backend.

if more information is needed, let me know.
Please and thank you.

it usually comes back as hostname.

postfix should be set to use main cert of the domain with that hostname.

in my example:

Network Tools: DNS,IP,Email

Just to add to what lawk said — the 220 banner showing the main hostname on every IP is actually normal Postfix behavior. The banner comes from smtpd_banner, which defaults to $myhostname, so it doesn’t change based on which IP the client connected to. You can confirm with postconf smtpd_banner myhostname.

The certificate part is the real issue for you. By default Postfix serves one certificate for all connections (whatever smtpd_tls_cert_file points at). To serve a different cert per domain you need SNI configured (tls_server_sni_maps). A quick way to see what’s actually being served on that IP:

openssl s_client -connect 192.168.171.222:25 -starttls smtp -servername my.correctdomain

and check the CN/SAN in the output.

In Virtualmin, open the virtual server for my.correctdomain and look under Server Configuration → Manage SSL Certificate — there’s a service certificates section where you can assign that domain’s cert to Postfix. That should get the right cert served without touching the banner.

this is also a fanstastic test: