example.com on A server and subdomain.example.com on B server - CentOS 7 [duplicate]

I'm wanting to host DNS for a domain while forwarding a subdomain to another server.

Something like this:

zone "xxx.test.com" in { type forward; forward only; forwarders { public-ip-here; }; };

zone "test.com" in { type master; file "domain/test.com"; };

From what I can tell, if I do this, the forward never actually happens. I'm not sure if the less specific test.com is somehow overriding it or if what I'm looking to do just needs to be done differently.

I'm running BIND 9.9.5-9+deb8u9-Debian (Extended Support Version) on both systems.


If you are master for the parent zone, then you should probably be setting up a delegation for the child zone, not trying to forward.

Do do a delegation just put something like this in the test.com zone.

xxx.test.com. IN NS servername.

Regarding my experience and tests, when you want forward a subzone when your server is authoritative on the parent zone, you must:

  • Declared the subzone you want forward in your named.conf as a forward zone type
  • Add the NS records related to the name server you will forward that subzone in the parent zone

With that configuration, your server will send a recursive request to the forwarders list you set in the subzone declaration in named.conf.

If you only add the NS records without declared the zone as forward zone in the named.conf, you delegate the zone and your DNS server will sent an iterative request.

If you only declared the subzone as forward zone type in the named.conf (and the parent zone is authoritative on your server), the forward will be not working.

Notes: You can check the iterative or recursive query by performing a traffic capture, and visible in flags section with parameter (DNS->Flags->Recursion Desired)

Choose delegation or forward can change a lot the DNS requests flow / DNS architecture choice (recursive or iterative DNS request)