BIND9 Return different IP address based on subnet

Christian Kette chriswaeldchen at outlook.de
Sat Dec 27 20:28:06 UTC 2014



        Hello,
I've got a raspberry pi with 5 network interfaces (3 WLAN and
 two wired LAN).
Also, I have set up a BIND 9 server. Now I want to give the PI (the 
hostname is "DEV") a different IP address for every single interface.


For example: when a client from the network 192.168.2.0/24 looks up 
the hostname "DEV.home.lan", he should get the response that 
"DEV.home.lan" has the IP 192.168.2.100.
When a client of the 192.168.10.0/24 network looks up that hostname, the
 IP should be 192.168.10.1.


As far as I know, this can be done using views. I could'nt get it working so I have some questions.
Q1: Why do I get the IP address "192.168.2.100" for "DEV.home.lan" from both the 192.168.2.0/24 and the 192.168.10.0/24 network?


The configuration files are set up as follows: 
1.


/etc/bin/named.conf 


include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
#include "/etc/bind/named.conf.default-zones";


I had to comment out the last line with the default-zones file because otherwise I get the error /etc/bind/named.conf.default-zones:2: when using 'view' statements, all zones must be in views (I think it's a default config file, but I can provide it when necessary). 


Q2: What exactly are these zones in the file for? Do I need them?


2.


/etc/bind/named.conf.options


options {
     directory "/var/cache/bind";
     forwarders {
         8.8.8.8;
         8.8.4.4;
     };
     dnssec-validation no;
     empty-zones-enable yes;
     auth-nxdomain no;    # conform to RFC1035
     listen-on-v6 { any; };
};


I don't think the error is in that file.


3.
/etc/bind/named.conf.local


view "local" {
    match-clients { any; };
    zone "home.lan" IN {
        type master;
        file "/etc/bind/db.home.lan";
    };
};
view "ext" {
    match-clients { 192.168.2.0/24;};
    zone "2.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.rev.2.168.192.in-addr.arpa";
    };
};
view "wlan0" {
    match-clients { 192.168.3.0/24;};
    zone "3.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.rev.3.168.192.in-addr.arpa";
    };
};
view "wlan00" {
    match-clients {192.168.4.0/24;};
    zone "4.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.rev.4.168.192.in-addr.arpa";
    };
};
view "wlan01" {
    match-clients {192.168.5.0/24;};
    zone "5.168.192.in-addr.arpa" {
       type master;
       file "/etc/bind/db.rev.5.168.192.in-addr.arpa";
    };
};
view "int" {
    match-clients {192.168.10.0/24;};
    zone "10.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.rev.10.168.192.in-addr.arpa";
    };
};


4.
/etc/bind/db.home.lan


home.lan. IN SOA DEV.home.lan. hostmaster.home.lan. (
    2013120101 ; serial
    8H ; refresh
    4H ; retry
    4W ; expire
    1D ; minimum
)
home.lan. IN NS    DEV.home.lan.
home.lan. IN MX 10 DEV.home.lan.
; Set the address for localhost.home.lan
localhost    IN A 127.0.0.1
; Set the hostnames in alphabetical order
DEV    IN A 192.168.2.100
router IN A 192.168.2.1
proxy  IN CNAME DEV.home.lan.
wpad   IN CNAME DEV.home.lan.


And finally, /etc/bind/db.rev.10.168.192.in-addr.arpa


; IP Address-to-Host DNS Pointers for the 192.168.10 subnet
@ IN SOA DEV.home.lan. hostmaster.home.lan. (
    2013120101 ; serial
    8H ; refresh
    4H ; retry
    4W ; expire
    1D ; minimum
)
; define the authoritative name server
           IN NS DEV.home.lan.
; our hosts, in numeric order
1         IN PTR router.home.lan.
1         IN PTR DEV.home.lan.


Thank you!


    
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20141227/63e558f1/attachment.html>


More information about the bind-users mailing list