Thursday, June 16, 2016

domain name system - dns - BIND - how to return a different IP based on request's subnet




We have an intranet DNS server (system-config-bind on RHEL) serving office A, and a VPN connecting offices A and B. Office A has a server named "dev".



In office A, to access a server "dev" on the local network, the address is 192.168.1.13



In office B, to access a server "dev" over the VPN, the address is 192.168.2.13



My question is this - can I set the DNS server to return a different IP for "dev" based on the subnet of the incoming request?



Example:

In office A, BIND returns 192.168.1.13 as the "dev" IP, because the originating request is from the 192.168.1/24 subnet.



In office B, BIND returns 192.168.2.13 as the "dev" IP, because the originating request is from the 192.168.2/24 subnet.


Answer



You need to use views:



view "officeA" {
match-clients { 192.168.1.0/24; };

include "/etc/named.conf.zones-rfc1912";

include "/etc/named.conf.zones-common";
include "/etc/named.conf.zones-officeA";
};

view "officeB" {
match-clients { 192.168.2.0/24; };

include "/etc/named.conf.zones-rfc1912";
include "/etc/named.conf.zones-common";
include "/etc/named.conf.zones-officeB";

};

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...