Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a domain configuration file called example.com.conf

I want to add the following subdomain to it: members.example.conf and add it's own MX records (it's running a seperate mail system).

How do I specify the MX records for a subdomain?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Same way you specify A records. Keep in mind MX records MUST be FQDNs, not IP addresses.

 $origin example.com
 subdomain      300 IN A 127.0.0.1
 mail.subdomain 300 IN A 127.0.0.1
 subdomain      300 IN MX 0 mail.subdomain.example.com.

Edit:

The first column in your file is currently blank because it's inherited from the record above it (likely your SOA record)

This should be just as valid as what I posted above:

 $origin example.com
 subdomain      300 IN A 127.0.0.1
                300 IN MX 0 mail.subdomain.example.com.
 $origin subdomain.example.com
 mail           300 IN A 127.0.0.1

Basically, there's more than one way to skin a cat. However, $origins can make things unnecessarily confusing, so sometimes it's better to be verbose.

share|improve this answer
    
Ah ok, so right now, to specify the MX records for the example.com domain, the first column is blank, but to specify the MX record for the subdomain, I just enter the name of it there..? –  Samuurai Dec 23 '09 at 17:13
    
See my edit in the above post –  brent Dec 23 '09 at 17:27
    
Thanks a lot for your help. We don't have an origin variable and our SOA looks like this:@ IN SOA ns1.example.com networks.example.com. ( serial, refresh etc...) It might be that it's getting it from the definition in named.conf.include ? –  Samuurai Dec 23 '09 at 18:01
    
BIND automatically sets $ORIGIN to whatever the domain name is set to in that zone's configuration section in named.conf. –  Alnitak Dec 24 '09 at 8:25

First, a name like this is not a subdomain, in strict terminology. It is just another name inside the current domain. If it were a subdomain, it would have NS records in the parent domain and and SOA record in the subdomain's file.

If you want to make another name inside your file, all you have to do is simply add it. As others have said, you need to add the MX records for it, using names on the right-hand side. Then add A records for those names. Inside domain "example.com" you could use:

newname          MX 100 mailhost.newname
mailhost.newname A 1.2.3.4

The TTL can be left to default (as I did here).

@ in the first column means "whatever this zone's apex name is" so it will be taken from the configuration file. @ is a lazy way to write the domain's apex, but only that. For example, you cannot use foo.@ to mean foo.example.com -- it won't work.

share|improve this answer
    
Thanks a lot. That clarifies it for me. I wish I could vote you up, but I don't have enough rep! –  Samuurai Dec 24 '09 at 9:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.