Mailserver for subdomain on different server

i am running several servers each running on virtualmin or webmin.

Their names are, etc.

Now i have domain on server01 with a pointing to server01.
On server02 i have the subdomain,

Now i would like to have a DNS record for the mailserver on server02 for subdomain

My solution would be:

create a A record for: with the IP of

create a mx-record in

server02 MX 10

Would this work or would i have to do something else?

Thanks and best


If you ask, why i do not put the subdomain on server01, it’s easy, server01 doesn’t have enough space left to server


It’s no problem to have a mail server for a given domain/sub-domain on a different server, and doing that is just a matter of setting the MX record like how you described.

The only issue is that you’d need to setup that other server to accept email for that domain, and setup your users on the mail server.

You could do that by installing Virtualmin on your mail server, create the same Virtual Server on the mail server, and then set it up with the “Mail for Domain” feature.

Also, make sure “Mail for Domain” is disabled for that domain on the web server.


the mailserver for is server01, where the domain is located. the mailserver mail2. is located on server02 where is located. Both are running virtualmin but if i send a mail to, it gets returned due to a Host or domain name not found. Name service error
for name

in my registry provider i can add subdomains as much as i need, also other mx entries, but i cannot assign a specific mailserver to a specific subdomain.

Which is what confuses me.

I have now several servers, some with no virtualmin, some with 10 domains running on it. To streamline everything i would like to change the hostnames (in underlying OS). WIll this lead to problems with webmin and virtualmin? I would also create the hostnames as webservers, so i can maintain a generic installation of phpmyadmin, roundcube etc. Could this work out? i also would have to swap the main server ip on one server as well and do not want to rebuild everything.

Thanks and best

PS: Would i have to change the dns entries in bind 9 so to point to the mail2. mailserver on the second one?

I have tried to find anythin on the internet, to help with this email on subdomain problem, but i couldn’t manage this. I suppose my brain is wrangled :slight_smile:

Anybody to shed some light, please?

Thanks and best


Since your thread is rather mangled (no offense), let me first clarify I understand your request.

You would like:” to handle mail for “

and” to handle mail for “

If this is what you desire, simply setup:

A Record for “” pointing to the IP of “

A Record for “” pointing to the IP of “

MX Record for “” pointing to either “” or “

MX Record for “” pointing to either “” or “

*** these are the minimal records, though SPF and DKIM records would also be recommended ***

If you desire something else, either contact me directly or post a reply here to clarify.

Best Regards, Peter Knowles TPN Solutions

Phone: 604-782-9342
Skype: tpnsupport

Ask me about my new support plans which include a FREE copy of Virtualmin Pro!!!