Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Split DNS but with specific MX

    Scheduled Pinned Locked Moved DHCP and DNS
    15 Posts 3 Posters 562 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MatDepInfo
      last edited by

      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.

      johnpozJ 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @MatDepInfo
        last edited by

        @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.

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.8, 24.11

        M 1 Reply Last reply Reply Quote 0
        • M
          MatDepInfo @johnpoz
          last edited by

          @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.

          johnpozJ 4 Replies Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator @MatDepInfo
            last edited by johnpoz

            @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

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            • johnpozJ
              johnpoz LAYER 8 Global Moderator @MatDepInfo
              last edited by johnpoz

              @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.

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 24.11 | Lab VMs 2.8, 24.11

              1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @MatDepInfo
                last edited by johnpoz

                @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...

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.8, 24.11

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator @MatDepInfo
                  last edited by johnpoz

                  @MatDepInfo here this is the simple way to do it..

                  simple.jpg

                  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 ;)

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                  M 2 Replies Last reply Reply Quote 0
                  • M
                    MatDepInfo @johnpoz
                    last edited by

                    @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".

                    johnpozJ 1 Reply Last reply Reply Quote 0
                    • M
                      MatDepInfo @johnpoz
                      last edited by

                      @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.

                      1 Reply Last reply Reply Quote 0
                      • johnpozJ
                        johnpoz LAYER 8 Global Moderator @MatDepInfo
                        last edited by johnpoz

                        @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

                        mx.jpg

                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                        If you get confused: Listen to the Music Play
                        Please don't Chat/PM me for help, unless mod related
                        SG-4860 24.11 | Lab VMs 2.8, 24.11

                        M 1 Reply Last reply Reply Quote 0
                        • Bob.DigB
                          Bob.Dig LAYER 8
                          last edited by

                          Maybe a DNSSEC problem? Just guessing.

                          1 Reply Last reply Reply Quote 0
                          • M
                            MatDepInfo @johnpoz
                            last edited by MatDepInfo

                            @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.

                            johnpozJ 1 Reply Last reply Reply Quote 0
                            • johnpozJ
                              johnpoz LAYER 8 Global Moderator @MatDepInfo
                              last edited by johnpoz

                              @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.

                              An intelligent man is sometimes forced to be drunk to spend time with his fools
                              If you get confused: Listen to the Music Play
                              Please don't Chat/PM me for help, unless mod related
                              SG-4860 24.11 | Lab VMs 2.8, 24.11

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                MatDepInfo @johnpoz
                                last edited by MatDepInfo

                                @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.

                                johnpozJ 1 Reply Last reply Reply Quote 0
                                • johnpozJ
                                  johnpoz LAYER 8 Global Moderator @MatDepInfo
                                  last edited by

                                  @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.

                                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                                  If you get confused: Listen to the Music Play
                                  Please don't Chat/PM me for help, unless mod related
                                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.