Mailserver for subdomain on different server

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

Their names are server01.example.com, server02.example.com etc.

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

Now i would like to have a DNS record for the mailserver on server02 for subdomain test.foo.com.

My solution would be:

create a A record for:

mail2.foo.com with the IP of server02.example.com

create a mx-record in example.com:

server02 MX 10 mail2.foo.com

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

Thanks and best

j_m

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

Howdy,

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.

-Eric

the mailserver for foo.com is server01, where the domain foo.com is located. the mailserver mail2. is located on server02 where test.foo.com is located. Both are running virtualmin but if i send a mail to blah@test.foo.com, 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
j_m

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
j_m

Hi,

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

You would like:

server01.example.com” to handle mail for “foo.com

and

server02.example.com” to handle mail for “test.foo.com

If this is what you desire, simply setup:

A Record for “foo.com” pointing to the IP of “server01.example.com

A Record for “test.foo.com” pointing to the IP of “server02.example.com

MX Record for “foo.com” pointing to either “foo.com” or “server01.example.com

MX Record for “test.foo.com” pointing to either “test.foo.com” or “server02.example.com

*** 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

Email: pknowles@tpnsolutions.com
Phone: 604-782-9342
Skype: tpnsupport
Website: http://www.tpnsolutions.com


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