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 637 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.
    • 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.