Koozali.org: home of the SME Server

How does SME handle DNS?

Offline InteXX

  • *
  • 39
  • +0/-0
    • www.intexx.com
How does SME handle DNS?
« on: January 19, 2013, 10:39:45 PM »
I need to emulate SME's handling of DNS in a Windows server; however I'm not an experienced hand when it comes to DNS itself. I manage to grope around and figure things out once I get pointed in the right direction. (Note that I'm not asking here how to administer a Windows server--I can find that knowledge under the proper context.)

At the moment the direction I -think- I should be headed is to have a look at SME's zone files. Where may I find them?

For example, I currently have one internal and two external domains configured (on the Domains tab). I need to do the same thing in Windows' DNS--have a single domain.local entry that resolves locally, alongside a handful of entries that resolve externally.

Are knowing where SME keeps its zone file(s) and then looking directly at them the first steps in understanding how to replicate this?

Thanks,
Jeff Bowman

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: How does SME handle DNS?
« Reply #1 on: January 19, 2013, 11:21:38 PM »
At the moment the direction I -think- I should be headed is to have a look at SME's zone files. Where may I find them?

tinydns doesn't have "zone files". tinydns uses dns records, contained in the file /var/service/tinydns/root/data.

The format is documented here:

http://cr.yp.to/djbdns/tinydns-data.html

You'll find many other informative essays about DNS and DNS software at:

http://cr.yp.to/djbdns.html

Offline InteXX

  • *
  • 39
  • +0/-0
    • www.intexx.com
Re: How does SME handle DNS?
« Reply #2 on: January 19, 2013, 11:33:29 PM »
Excellent, that's it!

Thank you very much, Charlie  :-)

Thanks,
Jeff Bowman

Offline InteXX

  • *
  • 39
  • +0/-0
    • www.intexx.com
Re: How does SME handle DNS?
« Reply #3 on: January 20, 2013, 12:23:27 AM »
tinydns doesn't have "zone files". tinydns uses dns records, contained in the file /var/service/tinydns/root/data.

Oops, I'm not finding anything in that file nor in the documentation that indicates how SME knows to forward external domain requests to that domain's host.

The file shows that external requests resolve to the server, but how does the server know that it's an external request? Is it something like this:

Code: [Select]
If (request=*.local) {
  type=internal
}
else
{
  type=external
}

Thanks,
Jeff Bowman

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: How does SME handle DNS?
« Reply #4 on: January 20, 2013, 05:34:06 PM »
Oops, I'm not finding anything in that file nor in the documentation that indicates how SME knows to forward external domain requests to that domain's host.

You'll have to keep reading the documentation. That file is used by tinydns, which only provides authoritative records. dnscache is the software which resolves queries which needs to make the decision about which server to query in order to obtain answers that it can't provide from its cache. So read up on dnscache.

SME server's dnscache configuration is a little unusual, since there are two instances, one which is used for all queries, and the other for any which are forwarded to external servers. We do it that way so that we don't lose the external cache when restarting dnscache after local configuration changes. So dnscache.forwarder is left running long term, and we reset dnscache if we change any local records (so that we invalidate the cache).

Offline InteXX

  • *
  • 39
  • +0/-0
    • www.intexx.com
Re: How does SME handle DNS?
« Reply #5 on: January 20, 2013, 11:01:23 PM »
Ah, OK.

That gets me pointed in the right direction.

Thanks for your help.

Thanks,
Jeff Bowman

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: How does SME handle DNS?
« Reply #6 on: January 21, 2013, 02:46:07 PM »
I need to emulate SME's handling of DNS in a Windows server; ...

That's a strange way to spend one's time.

Quote
(Note that I'm not asking here how to administer a Windows server--I can find that knowledge under the proper context.)

Good luck with that. I've more often found obfuscation than good technical information when searching Microsoft documentation.

Offline mmccarn

  • *
  • 2,626
  • +10/-0
Re: How does SME handle DNS?
« Reply #7 on: January 21, 2013, 03:09:46 PM »
Here's what I do on my windows servers:
1) Create a non-resolving local domain (myorg.local)
2) NEVER create a DOMAIN for my actual domain name

Unstead, I create domains for each of the servers on my domain that are on the local network, but not any domains for the servers on the internet.

So, since my mail server is local, I create a domain "mail.myorg.org" on my windows server, then set the A record for that domain to the LAN IP for my mail server. LAN users then get the LAN IP, while Internet users get the firewall's public IP from our public DNS.

Since my web server is off-site, I don't create any local entry for it; dns queries are forwarded off-site and resolve correctly to the public IP.

To break it down - imagine that my email and wiki are local, but my blog and main website are hosted outside of my office.  Here's what I end up with:

On my internet DNS (at Network Solutions):
mail.myorg.org points to my firewall IP
wiki.myorg.org points to my firewall IP
blog.myorg.org points to my blog host
www.myorg.org points to my web host

On my Active Directory Servers:
myorg.org HAS NO ENTRY
mail.myorg.org is a ZONE, with the A record set to the LAN IP for the mail server
wiki.myorg.org is a ZONE, with the A record set to the LAN IP for the wiki server
blog.myorg.org HAS NO ENTRY
www.myorg.org HAS NO ENTRY


Offline InteXX

  • *
  • 39
  • +0/-0
    • www.intexx.com
Re: How does SME handle DNS?
« Reply #8 on: January 21, 2013, 03:13:17 PM »
That's a strange way to spend one's time.

Due to the extra complexity with all of this, I've decided to dispense with the 'split mail routing' configuration and move all of our traffic to our external Exchange provider. Previously only a few aliases would keep mail for internal processing; all others would relay everything to the provider. This isn't worth the cost of a few additional mailboxes.



Good luck with that. I've more often found obfuscation than good technical information when searching Microsoft documentation.

I've waded neck-deep for hours in highly complex documentation that tells me how to design and build a nuclear-propelled craft for flying to Saturn using same, while turning up nothing that applies directly to the simple task at hand.

It's maddening.

Offline InteXX

  • *
  • 39
  • +0/-0
    • www.intexx.com
Re: How does SME handle DNS?
« Reply #9 on: January 21, 2013, 03:17:53 PM »
Here's what I do on my windows servers:
1) Create a non-resolving local domain (myorg.local)
2) NEVER create a DOMAIN for my actual domain name

Unstead, I create domains for each of the servers on my domain that are on the local network, but not any domains for the servers on the internet.

So, since my mail server is local, I create a domain "mail.myorg.org" on my windows server, then set the A record for that domain to the LAN IP for my mail server. LAN users then get the LAN IP, while Internet users get the firewall's public IP from our public DNS.

Since my web server is off-site, I don't create any local entry for it; dns queries are forwarded off-site and resolve correctly to the public IP.

To break it down - imagine that my email and wiki are local, but my blog and main website are hosted outside of my office.  Here's what I end up with:

On my internet DNS (at Network Solutions):
mail.myorg.org points to my firewall IP
wiki.myorg.org points to my firewall IP
blog.myorg.org points to my blog host
www.myorg.org points to my web host

On my Active Directory Servers:
myorg.org HAS NO ENTRY
mail.myorg.org is a ZONE, with the A record set to the LAN IP for the mail server
wiki.myorg.org is a ZONE, with the A record set to the LAN IP for the wiki server
blog.myorg.org HAS NO ENTRY
www.myorg.org HAS NO ENTRY

Very good, thanks.

And you've managed to answer another question of mine: I wasn't sure whether creating a subdomain.domain.com as a zone file unto itself was good DNSing in Windows. Apparently it's OK to do so.

Thanks,
Jeff Bowman