Score:-1

MX record pointing to a dynamic IP

tr flag

I'd like to host simple-login on my home Synology server. For this, I have to register an MX record on a domain that points my IP address.

However, my internet provider does not guarantee a fixed IP, though it's not changing a lot.

If I just buy a domain name, when my IP address changes, this can take up to 72h to be propagated to DNS servers, which is too long.

The only solution I see is using a dynamic DNS service somewhere in the chain.

Is it possible to register a MX record on a dynamic DNS? I can't find any clear information about that.

If so, how to do it?

Is a dynamic DNS enough? If so, how to register a MX record on it? Do I need a domain name? If so, how to ensure that my IP is always pointed to even when being refreshed by my ISP?

cn flag
Bob
Note that in addition to assigning dynamic IP's consumer grade ISP's frequently also have other restrictions and frequently block the SMTP port, TCP 25 as an anti-spam measure. Then you can't run a mail server at all.
Score:2
za flag

MX record never points to an IP, "static" or "dynamic". Period. It points to some domain name which is the name of the server who should process the incoming mail for a domain in question.

Nobody cares how the records actually appear on the DNS server. You may create MX records and all records it references via RFC2136 dynamic update, by editing a zone file or by other manipulation with the backend database the DNS server uses, whatever. It's all up to you. The result will be the same: if the user requests MX record via DNS and it is being replied with valid information, it will work.

What is "static" or "dynamic" IP? The primary difference from your point of view is how often your machine receives IP address other than it has before. Others account for how often the user is changed behind that IP address. If it is "often", the IP is said to be "dynamic".

It is possible to set up a mail server answering on "dynamic" IP address, you have to maintain some A record with low TTL value to always point to currently used IP address (as I said before, it is irrelevant exactly how you achieve this). Then you may set the MX record to reference that "dynamic" A record. Your server residing on the "dynamic" IP will receive the mail for a domain.


The problem is that sending mail from that server will be greatly obstructed. Those are other servers who usually don't accept mail from IP addresses which they know are "dynamic" (where the user is frequently changing), because it is hard to determine who is responsible for this or that message.

The IP ranges that ISPs worldwide use for their "dynamic" clients are simply all listed in special "policy" blacklists (this is Spamhaus, there are other projects doing essentially the same). Usually mail from addresses that appear in those blacklists is either completely rejected or at least its "spam score" is set to very high value, diverting it to "greylisting" path or to eventual drop. You don't control other mail servers behaviour and therefore can't do anything with this. And there is completely no point in fighting this situation; just send your mail from IP address which Internet behaviour you carefully control, which is impossible to do if your IP address frequently changes.

Notice, you don't need to originate mail from the same system or IP address you receive mail; just remember the incoming server (who is listed in the MX record) sometimes need to originate some protocol-related messages too (delivery notifications), so it may need to use smarthost if it can't send mail directly. For instance, your ISP may provide you some SMTP relay which your mail server residing on a "dynamic" IP address may use as a smarthost, as Spamhaus suggests. Some ISPs actually block you from sending a mail directly and require the use of their relay for that purpose (this is what the comment by @Bob up there is about).

Score:1
in flag

You need 1 domain you own (or at least can set records for)

You need a subdomain from a dynamic DNS provider which updates (the A record of) your BenjaminBarroisHomeIP.example.com every time your IP changes.

Then you set the MX on your own domain to BenjaminBarroisHomeIP.example.com

I dont know this "simple-login" and if it actually sends emails, but keep in mind: Most mailserver block emails originating from dynamic IP addresses and/or addresses that mismatch when reverse-resolving.

Benjamin Barrois avatar
tr flag
Interesting, thanks for that. So in general, is this impossible to have a working mail server hosted on a dynamic IP?
in flag
Well technically it is possible, but since this is also done by spammers, the chance of your emails beeing blocked is probably too high... Just receiving should work fine.
Score:0
gg flag

As others have said already, standing up a SMTP server on a new IP is something to be avoided like the plague. Not only does most ISPs block tcp/25 everywhere they can, aka. every single consumer connection, but even if you could get an static IP, it needs to have good reputation going back several years if you want to actually have your email delivered.

So if you really want to do this, I'd recommend getting a bunch of Digital Ocean droplets or equivalent small, cheap and cheerful cloud VMs and check the IP you get for them against block lists and reputation lists, and cycle though them until you find one that is untainted by spammers past.

Luckily the documentation for that project is quite good, and seems to cover all the other things you need to do to get it up and running.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.