On Tue, Sep 03, 2024 at 10:12:57AM +0800, LinuxMail.cc via Postfix-users wrote:

> IIRC for the group of IPs with the same weight,
> Postfix put them into a array with max size 8, and pick up one from the
> array by round robin.

Why guess?
    
    https://www.postfix.org/postconf.5.html#smtp_mx_session_limit
    https://www.postfix.org/postconf.5.html#smtp_mx_address_limit
    https://www.postfix.org/postconf.5.html#smtp_balance_inet_protocols

> > 
> > 1.- When there are different MX with different weight but the DNS
> > shows them in different order every time..:  does postfix consider the
> > weigth despite the order they are showed?  and what happens when two
> > MX has same weigth?

The order of RRs returned by a resolver has no meaning, and Postfix
randomises the order equal preference MX records.  As required by
RFCs (and loop avoidance), Postfix honours MX preferences.

> > 2.- When each MX point to multiple servers, i guess Postifx takes
> > always the first server from the list, is this correct?

No, the order of A/AAAA records is random with care to avoid starving
either the IPv4 or IPv6 address list when the address limit is smaller than
the total number of addresses.

> > what happens
> > if this server does not work? does Postfix takes the next server in
> > this list or will Postfix discard this list and go for the next MX?

MX records are used to obtain a list of weighted IP addresses, after
which the MX host names largely lose any relevance, unless TLS
authentication is employed to check for the MX hostname in the
presented certificate.

So in terms of connection policy, these behave the same:

   1.   some.example. IN MX 0 mx.some.example.
        mx.some.example. IN 192.0.2.1
        mx.some.example. IN 192.0.2.2
        mx.some.example. IN 192.0.2.3
        mx.some.example. IN 192.0.2.4

   2.   some.example. IN MX 0 mx1.some.example.
        some.example. IN MX 0 mx2.some.example.
        mx1.some.example. IN 192.0.2.1
        mx1.some.example. IN 192.0.2.2
        mx2.some.example. IN 192.0.2.3
        mx3.some.example. IN 192.0.2.4

In both cases connections will be attempted in random order to each of
the 4 IPs, until no deferred recipients remain or (default) 2 sessions
have been used up (positive EHLO response from the MX host).

Bottom line, Postfix works hard to deliver mail correctly and reliably,
if you can think of a mistake to not make, it is not made.  So there's
generally no need to worry and delve into the details.

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to