BIND9 Return different IP address based on subnet
Christian Kette
chriswaeldchen at outlook.de
Sat Jan 3 18:24:47 UTC 2015
I have found a workaround.
I defined a different zone for every network
My config files are now
/tec/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
/etc/bind/named.conf.local
view "local" {
match-clients { localhost; };
zone "home.lan" IN {
type master;
file "/etc/bind/db.home.lan";
};
};
view "ext" {
match-clients { 192.168.2.0/24;};
zone "home2.lan" IN {
type master;
file "/etc/bind/db.rev.2.168.192.in-addr.arpa";
};
};
view "wlan0" {
match-clients { 192.168.3.0/24;};
zone "home3.lan" IN {
type master;
file "/etc/bind/db.rev.3.168.192.in-addr.arpa";
};
};
view "wlan00" {
match-clients {192.168.4.0/24;};
zone "home4.lan" IN {
type master;
file "/etc/bind/db.rev.4.168.192.in-addr.arpa";
};
};
view "wlan01" {
match-clients {192.168.5.0/24;};
zone "home5.lan" IN {
type master;
file "/etc/bind/db.rev.5.168.192.in-addr.arpa";
};
};
view "int" {
match-clients {192.168.10.0/24;};
zone "home10.lan" IN {
type master;
file "/etc/bind/db.rev.10.168.192.in-addr.arpa";
};
};
/etc/bind/db.rev.10.168.192.in-addr.arpa
; IP Address-to-Host DNS Pointers for the 192.168.10 subnet
home10.lan. IN SOA DEV.home10.lan. hostmaster.home10.lan. (
2013120101 ; serial
8H ; refresh
4H ; retry
4W ; expire
1D ; minimum
)
; define the authoritative name server
home10.lan. IN NS DEV.home10.lan.
home10.lan. IN MX 10 DEV.home10.lan.
localhost IN A 127.0.0.1
DEV IN A 192.168.10.1
router IN A 192.168.10.1
proxy IN CNAME DEV.home10.lan.
wpad IN A 192.168.10.1
2014-12-28 19:59 GMT+01:00 <chriswaeldchen at outlook.de>:
> Thank you for the helpful answer.
> I changed the file /etc/bind/named.conf.local to
>
> view "local" {
> match-clients { 127.0.0.1; };
> 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";
> };
> };
>
>
> But now I get Non-existent domain error (on the raspberry machine) for
> - nslookup localhost
> - nslookup DEV.home.lan
>
> I don't understand why it can't find neither the localhost nor the
> DEV.home.lan entry in /etc/bind/db.home.lan
>
>
>
> 2014-12-27 22:57 GMT+01:00 Jeremy C. Reed <jreed at isc.org>:
>
>> On Sat, 27 Dec 2014, Christian Kette wrote:
>>
>> > 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 view that matches first is used.
>>
>> > #include "/etc/bind/named.conf.default-zones";
>> ...
>> > Q2: What exactly are these zones in the file for? Do I need them?
>>
>> You didn't include the file in the email. But I found a copy via google
>> which may be the same. You probably don't need it. (For example, the
>> priming hints are builtin to named.)
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20150103/08b102ce/attachment.html>
More information about the bind-users
mailing list