# Subdomain



## kimkaphann (Nov 11, 2013)

I'm using BIND98 and my domain is example.com. I installed two DNS servers.

Server 1: master.example.local - network: 192.168.1.50/24

```
zone "example.local" {
    type master;
    file "/etc/namedb/dynamic/example.local";
};
zone "1.168.192.in-addr.arpa" {
    type master;
    file "/etc/namedb/dynamic/1.168.192.in-addr.arpa";
};


$ORIGIN .
$TTL 3600       ; 1 hour
example.local              IN SOA  master.example.local. admin1.example.local. (
        2013102702 ; serial
        10800      ; refresh (3 hours)
        3600       ; retry (1 hour)
        604800     ; expire (1 week)
        300        ; minimum (5 minutes)
        )
        NS      master.example.local.
        A       192.168.1.50
        MX      1 mail.example.local.

$ORIGIN example.local.
master        A    192.168.1.50

$ORIGIN support.example.local.
@    IN    NS    ns2.support.example.local.
ns2    IN    A    10.0.0.50  ;Glue Record
```
Server 1: ns2.support.example.local. - network: 10.0.0.50/24


```
zone "support.example.local" {
    type master;
    file "/etc/namedb/dynamic/support.example.local";
};
zone "0.0.10.in-addr.arpa" {
    type master;
    file "/etc/namedb/dynamic/0.0.10.in-addr.arpa";
};


$ORIGIN support.example.local.
$TTL 3600       ; 1 hour
@             IN SOA  ns2.support.example.local. admin1.support.example.local. (
        2013102702 ; serial
        10800      ; refresh (3 hours)
        3600       ; retry (1 hour)
        604800     ; expire (1 week)
        300        ; minimum (5 minutes)
        )
        NS      ns2.support.example.local.
        A       10.0.0.50
        MX      1 mail.support.example.local.
ns2        A       10.0.0.50

$ORIGIN example.local.
@        IN        NS    master.example.local.
master        IN        A    192.168.1.50
```
When I `nslookup` at server 1 (master.example.local.), I can resolve ns2.support.example.local. When I `nslookup` at server 2 (ns2.support.example.local.), I can't resolve example.local.

Logging:

```
warning: /etc/namedb/dynamic/support.example.local:16: ignoring out-of-zone data (example.local)
warning: /etc/namedb/dynamic/support.example.local:17: ignoring out-of-zone data (master.example.local)
```
So, can someone tell me what's wrong in this configuration and how to fix?

Thanks anyway.


----------



## usdmatt (Nov 11, 2013)

I can't see any obvious problem from what you've given why ns2.support.example.com can't resolve itself. If this is the contents of your second zone file though:


```
$ORIGIN support.example.local.
$TTL 3600       ; 1 hour
@             IN SOA  ns2.support.example.local. admin1.support.example.local. (
        2013102702 ; serial
        10800      ; refresh (3 hours)
        3600       ; retry (1 hour)
        604800     ; expire (1 week)
        300        ; minimum (5 minutes)
        )
        NS      ns2.support.example.local.
        A       10.0.0.50
        MX      1 mail.support.example.local.
ns2        A       10.0.0.50

$ORIGIN example.local.
@        IN        NS    master.example.local.
master        IN        A    192.168.1.50
```

This zone file is for support.example.local. It can't contain any entries other than those for support.example.local or below, so the 2 entries at the end are invalid. They should both be removed (which is why BIND complains about out-of-zone data).


----------



## kimkaphann (Nov 11, 2013)

usdmatt said:
			
		

> I can't see any obvious problem from what you've given why ns2.support.example.com can't resolve itself.





> When I nslookup at server 2 (ns2.support.example.local.), I can't resolve example.local.



It means that hen I `nslookup` at server 2, it can't resolve server 1.




			
				usdmatt said:
			
		

> . It can't contain any entries other  than those for support.example.local or below, so the 2 entries at the  end are invalid. They should both be removed (which is why BIND  complains about out-of-zone data).



Sub-zone configuration comes from this link: http://www.zytrax.com/books/dns/ch9/delegate.html

The 2 entries at the end are glue records.


----------



## usdmatt (Nov 11, 2013)

I think *I*'m getting closer to your problem now. You can't delegate from a subdomain to its parent. It makes no sense.

Your second server has no entries for example.com. As mentioned, the two 'glue' records are invalid, and being ignored. If you have forwarders set up, then it will try those, but if they are real DNS servers, then obviously they will know nothing about your example.com domain.

I'm not sure exactly what you're trying to achieve. It would be much easier to have all the DNS for example.com and support.example.com done on server1, rather than delegate. Unless the second server (and the support.example.com domain) is being administered by someone else and they have to have their own control, it seems like a lot of mess for nothing.

The only way I can see you getting your server2 to correctly find records for example.com, is to either:


Add example.com as a secondary zone on server2, with server1 as the master so it becomes authorative for example.com and responds to queries
Add server1 as the forwarder on server2. When server2 receives queries for example.com, it should ask its forwarder. (As far as server2 is concerned, it has nothing to do with example.com, and so will pass queries onto its forwarder - as long as recursion is enabled)

Edit: I see the page you linked has a incorrect glue record like yours. (no NS just the A)

```
ns1.example.com.  IN      A      192.168.0.3 ; 'glue' record
```
He'll be getting the same out-of-zone warning for that line.


----------



## kimkaphann (Nov 11, 2013)

Thanks for your commment.
Let me try to configure as you suggested.


----------



## kimkaphann (Nov 11, 2013)

@usdmatt, the first solution is possible. I configured server1 as master and server2 as slave. The second solution can't solve the problem.When I `nslookup` at server2, there's an error appearing: 

```
** server can't find master.master.example.local: NXDOMAIN
```


----------

