# DNS server with working MX records...



## krokodilen (Aug 10, 2002)

a few days ago I set up my own DNS server, it works fine and all, 
but now i tried to get the mail working aswell, 
I created a user with the mail account: davey@davey.com 

and I can send mail from that account, 
but I can't recieve any. When I check the mail log files it says "SMTP Server Posted 1 message with a total size of 1 (k)", 
so the mail server get the msg and store it, but don't send it to the user... 

So I would like someone to verify my dns file, I'm not sure if the records are as it should be... 

___ 


; 
; Default db.example file installed by davey 
; 

davey.com. IN SOA dns.davey.com. davey.davey.com. ( 
1 ; Serial 
10800 ; Refresh after 3 hours 
3600 ; Retry after 1 hour 
604800 ; Expire after 1 week 
86400 ) ; Minimum TTL of 1 day 

; 
; Name servers 
; 
davey.com. IN NS dns.davey.com. 
dns.davey.com. IN MX 10 mail.davey.com. 

; 
; Addresses for the canonical names 
; 
localhost.davey.com. IN A 127.0.0.1 
dns.davey.com. IN A 10.32.15.100 
gateway.davey.com. IN A 10.32.15.1 

; 
; Aliases 
; 
mail.davey.com. IN CNAME dns.davey.com. 
www.davey.com. IN CNAME dns.davey.com. 
test.davey.com. IN CNAME dns.davey.com. 

_ 

I run OSX Server 10.1.4 

Do I need to make other subdomains like pop.davey.com and smtp.davey.com? 

or what's the deal?


----------



## btoneill (Aug 10, 2002)

You have some serious issues with your zone file  First there is no need to have the FQDN on the left side. Because the zone is for davey.com it will automatically add it to the end. Putting the whole domain will "work" it's not the best thing to do, and will confuse folks. Second, you setup an MX record for davery@dns.davey.com, not davey@davey.com. Third, in your attempt to setup the MX record you pointed it at a CNAME, an MX record should always always always always point to an A record (canonical name). Bad things happen when you start pointing MX records at CNAMEs. The names mail/pop/smtp/etc have nothing to do with the mail protocol at all. It's just pretty names that folks like to use so it's easy to remember what values to stick in your mail client. Most mail clients (ie. GUI clients) do not even lookup the MX record themselves, they simply send all mail to the SMTP server you have configured, and your SMTP server itself does all the work on figuring out how to route the messge. So, you'd still want to use the mail.davey.com address to put in the field for SMTP server on your client, but the server shouldn't know anything about it.

Try this:

```
;
; Default db.example file installed by davey
;

davey.com. IN SOA dns.davey.com. davey.davey.com. (
                        1       ; Serial
                        10800   ; Refresh after 3 hours
                        3600    ; Retry after 1 hour
                        604800  ; Expire after 1 week
                        86400 ) ; Minimum TTL of 1 day

;
; Name servers
;
                IN      NS      dns.davey.com.

;
; Mail servers
;
                IN      MX      10 dns.davey.com.

;
; Addresses for the canonical names
;
localhost       IN      A       127.0.0.1
dns             IN      A       10.32.15.100
gateway         IN      A       10.32.15.1

;
; Aliases
;
mail            IN      CNAME   dns.davey.com.
www             IN      CNAME   dns.davey.com.
test            IN      CNAME   dns.davey.com. 

;; the end
```

To test, once you get his installed do this at a command line:
nslookup -q=mx davey.com 127.0.0.1

You should get output similar to this:
Server:  localhost.davey.com
Address:  127.0.0.1

davey.com   preference = 10, mail exchanger = dns.davey.com
davey.com   nameserver = dns.davey.com
dns.davey.com       internet address = 10.32.15.100

If you have any other questions/problems feel free to let me know, and I'll help where I can.


Brian


----------



## krokodilen (Aug 10, 2002)

aha!

Thanks alot!

I was also wondering if you run more then one domain on the same box,
like davey.com
and mikey.com should the dns records for them be in the same file,
or should they use separate?


----------



## btoneill (Aug 10, 2002)

Diffent zone files. The reverse will all use the same file (not sure if you're even messing with reverse lookups or not). 

Brian


----------



## krokodilen (Aug 11, 2002)

the nslookup command return what you said it should,

but i get a error in the mail log:
Resolver: NO_DATA
GetMXRecord for dns.davey.com failed.


__

And "mail server is not using host relay list"

what does that mean?


----------



## krokodilen (Aug 11, 2002)

unless I put it like this I get a error in the logfile.



;
; Mail servers
;
dns.davey.com.                IN      MX      10 dns.davey.com.


----------



## btoneill (Aug 12, 2002)

Are you using the named that comes with OS X? Or did you compile a new one? I'll check when I get home on the OS X compiled one, but works fine on my named on my Solaris box, but really shouldn't matter.

Brian


----------



## krokodilen (Aug 12, 2002)

at first I used the example file and edited it after my needs,
then I cut n pasted yours.

but it gave me errors until I modified the mx record as I've it now.


----------

