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

Fri Sep 24 20:41:30 UTC 2010
Robert Heller <heller at deepsoft.com>

At Fri, 24 Sep 2010 21:58:09 +0200 CentOS mailing list <centos at centos.org> wrote:

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

You need:

ns1.exampleA.com. IN      A       1.1.1.1
ns2.exampleA.com. IN      A       1.1.1.2

And you might also consider:

www.exampleA.com. IN      A       1.1.1.1
www.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

And:

ns1.exampleB.com. IN      A       1.1.1.3
ns2.exampleB.com. IN      A       1.1.1.4

And you might want to consider:

www.exampleB.com. IN      A       1.1.1.3
www.exampleB.com. IN      A       1.1.1.4


> 
> 
> 
> How does that look?
> 

-- 
Robert Heller             -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
heller at deepsoft.com       -- Contract Programming: C/C++, Tcl/Tk