I have a single CentOS server (amanda01) with three IP addresses on three different subnets. eth0 = subnet eth0.vlan101 = subnet eth0.vlan107 = 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 amanda01.domain.grp IN A amanda01.domain.grp IN A

From a server that is on the 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, I only want a response of

1 Answer 1


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, 2019 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, 2019 at 18:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .