DNS server, return 127.0.0.1 when the computer that makes the query has the IP of the answer

0

I have configured Raspbian with a Raspberry Pi , which makes me a DHCP server and DNS (bind) among other things.

On the DNS server I have several internal domains configured, for example:

www.mydomain.local Suppose you point to 192.168.0.80

As the DHCP server is configured to assign, to the clients, to itself as a DNS server, all the devices in my network recognize and navigate to the local domains.

What I need to know, if it is possible to do, is that when a request to the DNS server comes from the IP of the response, return 127.0.0.1 em> instead of the IP of the subnet, example:

If the computer with IP 192.168.0.80 queries for the domain www.mydomain.local , instead of returning 192.168.0.80 , which is what would return to other computers, should return 127.0.0.1

I know that I can solve this by writing the entry in the host file of the computer in question, but I would do better than it could resolve the DNS server

    
asked by FRL 12.09.2016 в 21:11
source

1 answer

2

I have found the solution, it is in English link

As of Bind 9 you can create different views to return different IP information according to the client

view "developer" {
        match-clients { 192.168.1.155; };
        include "/etc/named.conf.zones-rfc1912";
        include "/etc/named.conf.zones-common";
        include "/etc/named.conf.zones-developer";
};
// sin match-clients es el resto
view "all" {    
        include "/etc/named.conf.zones-rfc1912";
        include "/etc/named.conf.zones-common";
        include "/etc/named.conf.zones-developer-for-all";
};

This allows me to configure the domains that I need to point to 127.0.0.1 for the development computer and the IP of that computer for the rest.

    
answered by 29.10.2016 в 04:15