Change default MX entry.

How do you change the default mx entry that gets generated in the DNS record for new virtual servers?

At the moment it defaults to mail.domain.tld, and there is also an entry for that in the A records.

I have looked everywhere and cannot find how to change it to something else.


Well, there’s no simple way to do that… typically, folks running Virtualmin would would use the default A/MX records that have email pointing to itself.

The only way I can think of to accomplish that would be if you went into System Settings -> Server Templates -> Default -> BIND DNS Domain, and you configured “BIND DNS records for new domains” with all the DNS records you wanted to use. You’d have to set “Use only the records above” with that option.

However, it’s fairly rare that anyone would need that… in fact, I think you’re the first to ask :slight_smile:

Is there a particular problem you’re trying to solve? I’m curious if maybe there’s a different way to go about that.


Like Eric said – When Virtualmin is configured to receive mail for a server (by turning on that feature), it will instruct Postfix accordingly, and create the MX record pointing to itself. That’s the only thing that makes sense in this case.

If you want a different MX (which can of course happen if you wish to use an external mail server – some of my customers have their zones set up to use Google Mail), you a) need to turn off the “Mail for domain” feature, and b) add a custom BIND entry, directly to the existing server in question, or to the template for new servers like Eric explained.


i need to change the default ip for default mx record.

1.public ip < nat > first private ip on Virtualmin (shared) for virtual Server

2.public ip for webmin on port 443 + mailserver (on this ip rdns-entry exists) < nat > second private ip on Virtualmin

When i create a new server, the first ip will use for mx entry, but i need the second ip there

Can i change default setting globally (bind only second ip on postfix) or is the only way make changes to templates like above ?

And last but not least, Virtualmin is great!

solved, i simply change private ip´s/roles and now it´s fine :slight_smile: