How does Postfix deliver mails if it gets multiple MX hosts with the same preference?

Solution Unverified - Updated -

Issue

  • How does Postfix deliver mails if it gets multiple MX hosts with the same preference?
  • The Postfix has a relay host mail.sample.com and DNS provides multiple MX records with same preference for the domain. How will the Postfix choose the destination?
/etc/postfix/main.cf
~~~
relayhost = mail.sample.com
~~~

# dig @localhost mail.sample.com mx

; <<>> DiG 9.11.36-RedHat-9.11.36-3.el8 <<>> @localhost mail.sample.com mx
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60219
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mail.sample.com.       IN  MX

;; ANSWER SECTION:
mail.sample.com.    0   IN  MX  10 192.168.122.161.
mail.sample.com.    0   IN  MX  10 192.168.122.39.

;; Query time: 0 msec
;; SERVER: ::1#53(::1)
;; WHEN: Sun Dec 11 22:39:40 EST 2022
;; MSG SIZE  rcvd: 105

Environment

  • Red Hat Enterprise Linux
  • Postfix

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content