[CentOS] Configuring BIND to answer to two domain names (four IP addresses)

Fri Sep 24 17:49:51 UTC 2010
James A. Peltier <jpeltier at sfu.ca>


----- Original Message -----
| > Have a read for the listen on directive for BIND which tells BIND
| > what
| > interfaces/IP Addresses to bind to.
| 
| Thanks, I am aware that Apache can be told to listen only to specific
| addresses. Can BIND be told to listen on all addresses? Your post
| implies that this is the default (which makes sense, as so does
| Apache), maybe I am chasing a non-issue?
| 
| In other words, I should configure BIND to answer to exampleA.com and
| to exampleB.com with no regard to IP addresses. then in the control
| panel for each domain name configure the nameservers to my liking
| (with addresses that the server answers to, naturally)? That's it?
| 
| 
| >  Alternatively, you could just configure BIND identically on both
| >  machines and ensure that
| > they are setup in a master/slave configuration so that each name
| > server could answer
| > requests for both domains and publish both name server records in
| > each domain.
| >
| 
| There is only one machine. All four addresses point to it.
| 
| --
| Dotan Cohen
| 
| http://gibberish.co.il
| http://what-is-what.com
| _______________________________________________
| CentOS mailing list
| CentOS at centos.org
| http://lists.centos.org/mailman/listinfo/centos


BIND has listen on directives as well, but if this is a single box configuration it's not necessarily required as it will listen on all interfaces.

As far as configuring the domains, well that's pretty simple. In your DNS records for each domain you would define NS records such as this

$TTL 1d
@               IN      SOA     ns1.exampleA.com. hostmaster.exampleA.com. (
                                2010092401      ; PUT SEQUENCE NUMBER HERE (YYYY/MM/DAY/CHANGE #)
                                3600            ; Refresh every hour
                                600             ; Retry   - every ten minutes
                                604800          ; Expire  - after one week
                                 1h ) ; Minimum 1H
                IN      NS      ns1.exampleA.com.
                IN      NS      ns2.exampleA.com.

;; Hosts Section

ns1     IN     A     1.1.1.1
ns2     IN     A     1.1.1.2
www     IN     A     1.1.1.3

Keep in mind that you don't need A records for the NS records if you are pointing to a different name server so your exampleB your records might look like this


$TTL 1d
@               IN      SOA     ns1.exampleB.com. hostmaster.exampleB.com. (
                                2010092401      ; PUT SEQUENCE NUMBER HERE (YYYY/MM/DAY/CHANGE #)
                                3600            ; Refresh every hour
                                600             ; Retry   - every ten minutes
                                604800          ; Expire  - after one week
                                 1h ) ; Minimum 1H
                IN      NS      ns1.exampleA.com.
                IN      NS      ns2.exampleA.com.

;; Hosts Section

www             1.1.1.4

Notice that the NS records point to ns1 and ns2.exampleA.com.

Notice the A records for www.example{A,B} which should match your Apache instances if you are doing IP based hosting.  If you are doing name based hosting you *could* DNS round robin the requests.

Master and Secondary DNS configurations are defined in your named.conf file.  This doesn't matter in your necessarily for your configuration, but thought I would point it out.


On the master

zone "examplea.com" {
        type master;
        file "zone.examplea.com";
        allow-transfer { ns2.examplea.com }
};


On the secondary

zone "examplea.com" {
        type slave;
        masters { ns1.examplea.com };
        file "zone.example.com";
};


--
James A. Peltier
Systems Analyst (FASNet), VIVARIUM Technical Director
Simon Fraser University - Burnaby Campus
Phone   : 778-782-6573
Fax     : 778-782-3045
E-Mail  : jpeltier at sfu.ca
Website : http://www.fas.sfu.ca | http://vivarium.cs.sfu.ca
MSN     : subatomic_spam at hotmail.com

Does your OS has a man 8 lart?
http://www.xinu.nl/unix/humour/asr-manpages/lart.html