5

I have a single CentOS server (amanda01) with three IP addresses on three different subnets. eth0 = 10.0.2.0 subnet eth0.vlan101 = 10.101.0.0 subnet eth0.vlan107 = 10.107.0.0 subet

(As you can see each IP is on its own VLAN and each VLAN goes out the parent interface eth0)

My DNS server has three A records in it. amanda01.domain.grp IN A 10.0.2.81 amanda01.domain.grp IN A 10.101.0.14 amanda01.domain.grp IN A 10.107.0.14

From a server that is on the 10.0.2.0 subnet, I ping the hostname amanda01 and the DNS server responds with any of the three IPs listed above. This is clearly round-robin behavior.

My question is as follows:

How can I make the DNS server only respond with the subnet that the originating request came in on? ie: If the server I'm pinging from is on IP 10.0.2.11, I only want a response of 10.0.2.81.

6

You have to use what's called a Split Horizon or Split View DNS.

Not all servers support this. You might have to use ISC BIND in order to accomplish this, as NSD from NLnet Labs and most other modern rewrites don't advertise support for this.

From the practical perspective, I'd recommend looking into creating a single zone with all the hostnames in it, and then using a shell script to automatically generate split zones based on the original zone (by selecting only the respective subnets for each split view). You could use something like grepcidr if your subnets are more complicated than mere /24.

  • Brilliant sir!! – AfroJoe Aug 8 at 18:37
  • BTW, you can probably still make this work with NSD as well — you probably just have to run multiple independent copies of NSD, each listening on specific hardcoded IP addresses, and serving their own zone files. It should be relatively simply to automate with a shell script that'll take a master configuration and zone file, and would either replace placeholder IP addresses (e.g., with sed), or grep -v the extra ones, or some such. – cnst Aug 8 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.