The MX Algorithm
That’s the basic idea behind MX records and mail exchangers, but there are a few more wrinkles you should know about. To avoid routing loops, mailers need to use a slightly more complicated algorithm than what we’ve described when they determine where to send mail.[1]
Imagine what would happen if mailers didn’t check for routing loops. Let’s say you send mail from your workstation to nuts@oreilly.com, raving (or raging) about the quality of this book. Unfortunately, ora.oreilly.com is down at the moment. No problem! Recall oreilly.com’s MX records:
oreilly.com. IN MX 0 ora.oreilly.com. oreilly.com. IN MX 10 ruby.oreilly.com. oreilly.com. IN MX 10 opal.oreilly.com.
Your mailer falls back and sends your message to ruby.oreilly.com, which is up. ruby.oreilly.com’s mailer then tries to forward the mail on to ora.reilly.com but can’t because ora.oreilly.com is down. Now what? Unless ruby.oreilly.com checks the sanity of what she is doing, she’ll try to forward the message to opal.oreilly.com or maybe even to herself. That’s certainly not going to help get the mail delivered. If ruby.oreilly.com sends the message to herself, we have a mail routing loop. If ruby.oreilly.com sends the message to opal.oreilly.com, opal.oreilly.com will either send it back to ruby.oreilly.com or send it to herself, and we again have a mail routing loop.
To prevent this from happening, mailers discard certain MX records before they decide where to send a message. A mailer sorts the list ...
Get DNS on Windows Server 2003, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.