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

Fri Sep 24 19:58:09 UTC 2010
Dotan Cohen <dotancohen at gmail.com>

Thank you for all the help so far. To conclude:
I have one physical server that answers to the following IP addresses:
1.1.1.1
1.1.1.2
1.1.1.3
1.1.1.4

I need 1.1.1.1 & 1.1.1.2 to be the name servers for exampleA.com, and
1.1.1.3 & 1.1.1.4 to be the nameservers for exampleB.com. I have these
files:

# cat /etc/named.conf

options {
        directory "/etc";
        pid-file "/var/run/named/named.pid";
        listen-on {
                any;
                };
        };

zone "." {
        type hint;
        file "/etc/db.cache";
        };

zone "exampleA.com" {
        type master;
        file "/var/named/exampleA.com.hosts";
        };
zone "exampleB.com" {
        type master;
        file "/var/named/exampleB.com.hosts";
        };



# cat /var/named/exampleA.com.hosts

$ORIGIN exampleA.com.
$TTL 1h
exampleA.com. IN      SOA     ns1.exampleA.com. ns2.exampleA.com. (
                        1; Serial - increment me
                        10800
                        3600
                        604800
                        38400 )
exampleA.com. IN      NS      ns1.exampleA.com.
exampleA.com. IN      NS      ns2.exampleA.com.
exampleA.com. IN      A       1.1.1.1
exampleA.com. IN      A       1.1.1.2



# cat /var/named/exampleB.com.hosts

$ORIGIN exampleB.com.
$TTL 1h
exampleB.com. IN      SOA     ns1.exampleB.com. ns2.exampleB.com. (
                        1; Serial - increment me
                        10800
                        3600
                        604800
                        38400 )
exampleB.com. IN      NS      ns1.exampleB.com.
exampleB.com. IN      NS      ns2.exampleB.com.
exampleB.com. IN      A       1.1.1.3
exampleB.com. IN      A       1.1.1.4



How does that look?

-- 
Dotan Cohen

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