Firstly I successfully have a domain working in a chroot named. There are files in /var/named/chroot/var/named called mydomain.com.db and named.local and named.root.

Also in /var/named/chroot/etc there is named.conf.

So mydomain.com works as both a hosted website and it has ns1.mydomain.com and ns2.mydomain.com.

Now what I want to do is only to add another domain mydomain2.com to this setup, however I'm having trouble to find tutorial articles on adding another domain. They mostly seem to focus on just the adding of the first domain.

I guess I have to create a new zone file and reference it in the named.conf but I don't know what the zone file should contain. I tried some trial and error guessing but it didn't work.


You add the second domain the same as the first -- create an entry in /var/named/chroot/etc/bind/named.conf referring to the new zone and its filename (easiest way is to copy over the line from mydomain.com and rename mydomain to mydomain2 on all points of the line, then copy mydomain.com.db over to mydomain2.com.db and edit the new file to reflect the differences between mydomain.com and mydomain2.com

You can (and probably should) use the same NS and MX records for both domains.

ETA: The line in named.comf will look roughly like this:

zone "mydomain.com" { type master; file "mydomain.com.db"; };

A proper hosts file looks something like this:

@               IN      SOA     ns.mydomain.com.  postmaster.mydomain.com. (
                2011060701 ; serial
                28800      ; refresh
                7200       ; retry
                604800     ; expire
                86400)     ; minimum
; Nameserver(s) for the mydomain.com domain
@               IN      NS      ns.mydomain.com.
                IN      NS      ns2.mydomain.com.
                IN      NS      ns3.mydomain.com.
; Mail server(s) in the mydomain.com domain
@                   IN      MX      10      mail.mydomain.com.
                    IN      MX      20      some.fallback.server.
; Address record(s) for the mydomain.com domain 
localhost      IN      A     
@              IN      A     
www            IN      CNAME           mydomain.com.
mail           IN      A     
pop3           IN      CNAME           mail

Note that any FQDN name HAS to end with a . or bind will implicitly tack mydomain.com after it. Lines preceded by a semicolon are comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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