Split DNS but with specific MX
-
Hello, I use several linux VMs (Plesk hosted) managed by PfS and I use Split DNS for internal request between VMs. But for one domain (hosted by Plesk), the MX refers to M365 and its not hosted by Plesk itself. When I send email from one domain from another VM to this domain, it's not working. No problem if email are hosted by Plesk (so with MX is domain itself). I don't know how to deal with that.
-
@MatDepInfo if the email is hosted locally just change mx record to point to whatever the local server IP is.
Can you post the domain your trying to send mail too, send it via a PM if you don't want to post it public.. But a MX should point to a fqdn, which you could then create a local A record for that points to your local server.
-
@johnpoz Yes I have change MX in Plesk for this domain to M365. But as I put in the DNS resolver that such domain refers to a local address (192.168.x.x) I have the impression that it will not look for the MX. No problem when I send email to this domain from a email which is not hosted in this local network. Problem only appears when I send email from another domain in the local network.
-
@MatDepInfo send me the actual domain please in PM so I can look to what the MX record is.
It sure isn't just m365.com
-
@MatDepInfo so per what you sent me yourdomain.mail.protection.outlook.com
you would need to create a MX record in unbnound, using the custom optionk box either points that mx record to your IP locally. Or just that fqdn A record to your local IP that handles your mail
Now client would use the public dns to look up the fqdn mx record yourdomain.mail.protection.outlook.com, and then when goes to talk to that fqdn, it would lookup the A record that points to your local IP.
So if you create a MX record it would point to whatever local fqdn you want to use that handles your mail locally, or just create an A record for that yourdomain.mail.protection.outlook.com that points to your local IP.
-
@MatDepInfo you seem to have more questions.. lets see if can be more clear..
The current mx record for domain points to this
yourdomain.mail.protection.outlook.com.
This in turn has an A record that points to some public IPs for MS..
If you want some local device trying to send mail to talk to your local server then couple ways to skin the cat, either create a MX record in unbound via the custom option box that points to some local fqdn.. Or just create a host override for yourdomain.mail.protection.outlook.com that points to your local IP...
-
@MatDepInfo here this is the simple way to do it..
when something on your network says hey I want to send an email to yourdomain it looks up the MX record for the domain, which points to the fqdn yourdomain.mail.protection.outlook.com.
It then finds the IP by doing dns query for that fqdn.. Which you just point to your local IP.
The other way to do it is just create the local MX record so when the devices says hey want to lookup mx for yourdomain, it gets back say yourhost.localdomain.tld which resolves locally to whatever is handling mail local IP.
Clearly you would use the local IP of what is running mail for that domain vs my example 192.168.1.100 IP ;)
-
@johnpoz I just try this but not working. Pinging domain.mail.protection.outlook.com from internal VM show me well domain internal ip, but nslookup -type=MX domain give me "No Answer".
-
@johnpoz I try to add custom options in Unbounds too:
local-data: "domain.mail.protection.outlook.com. IN MX 10 domain."But still not working.
-
@MatDepInfo said in Split DNS but with specific MX:
ut nslookup -type=MX domain give me "No Answer".
Well has to do with dns in general failing.. I can lookup the mx record for yourdomain, it points to that outlook fqdn... If you can not look this up then no its not going to work be it that is public or local record you created. If something trying to send mail can not lookup the MX record - then no mail is not going to work.. no matter where the A record of that fqdn points to.
edit: here is example of creating a local MX record, and then a A record that points it to your local IP
-
Maybe a DNSSEC problem? Just guessing.
-
@johnpoz If email are hosted directly by Plesk on vm in internal network, email works even if I get No Answer in nslookup. I'm a little bit lost. I try with:
server: local-zone: "domain" transparent local-data: "domain IN MX 10 domain.mail.protection.outlook.com" local-data: "domain.mail.protection.outlook.com IN A 192.168.12.10"
But no changes.
-
@MatDepInfo where is the sender looking for dns?
If I want to send email to billy@domain.com the mail server that is sending has to look up the MX record for domain.com.. Once it has the fqdn from this MX record it will lookup that IP for that fqdn A record.
It will then attempt to make a connection to that IP address.
If your plesk is handling dns for the VMs you have running on it - you will have to make sure that dns points to where you want the actual mail to go.
Where are you getting this problem exactly
ut nslookup -type=MX domain give me "No Answer".
If the mail server wanting to send mail can not look up the MX record for the domain its wanting send email to then no its never going to work, no matter where the fqdn of that mx record points too.
-
@johnpoz OK I finally did it !! I only write that in inbounds options:
server: local-zone: "domain" transparent local-data: "domain IN MX 0 domain.mail.protection.outlook.com"
and now it's working.
Thank you for all your explanations, I now understand the email process better. -
@MatDepInfo well that isn't sending it to your local anything - yourdomain.outlook points to public IPs owned by MS.. So your sending the email there, and then it forwards that to you I take it.