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

Fri Sep 24 18:03:37 UTC 2010
Dotan Cohen <dotancohen at gmail.com>

On Fri, Sep 24, 2010 at 19:49, James A. Peltier <jpeltier at sfu.ca> wrote:
> 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.
>

Yes, I actually do want it to listen on all addresses (only one NIC),
I don't know why I thought that it had to be explicitly configured.


> 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.
>

That is quite the point: I need the nameservers for exampleA.com and
exampleB.com to be different!


> 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.
>

If the nameservers are for specific addresses, and Apache serves based
on FQDN as opposed to based on address, then I think that Apache can
answer on all addresses.


> 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";
> };
>
>

Thanks. I will do another for exampleB.com as well, to keep them separate.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com