Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Query different DNS for different subnets. How?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Sat May 01, 2010 2:30 pm    Post subject: [solved] Query different DNS for different subnets. How? Reply with quote

Hi there,

did a lot of reading today and still I have no idea on how to solve this.

Got a little home network with a server (192.168.1.1) using bind to resolve names for my local domain (B15.lan). The local network is wired. Server and clients connect to the internet through a wireless router (192.168.111.1). This router is (should be) name server for all non-local hosts.

My laptop has two network interfaces: eth0 and wlan0. The laptop queries the local name server in all cases, even if the host is not on the local subnet. Sometimes the wireless connection of the local server fails and named cannot resolve external hosts. As a result my laptop cannot connect to that host despite having a working wireless connection.

So, my goal is to configure the laptop to only query the local name server for local hosts and query the wireless router for all remote hosts. How can I do this? As I already wrote, I did a lot of reading today and tried quite a lot of different configuration. No luck so far.

I have openresolv installed and resolv.conf looks like this:
Code:
# Generated by resolvconf
search B15.lan B15
nameserver 192.168.1.1
nameserver 192.168.111.1


This is /etc/conf.d/net:
Code:
ifplugd_eth0=""
config_eth0="dhcp"
#dhcpcd_eth0="-A -d -t 60"
#dns_domain_eth0="b15.lan"
#dns_servers_eth0="192.168.1.1"
#dns_search_eth0="b15.lan"
routes_eth0="192.168.1.0/8 via 192.168.1.1"

modules_wlan0="wpa_supplicant"
wpa_supplicant_wlan0="-Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf"
wpa_timeout_wlan0=60
config_wlan0="dhcp"
dhcpcd_wlan0="-t 60"
routes_wlan0="default via 192.168.111.1"
#dns_servers_wlan0="192.168.111.1"

The lines commented out don't improve the situation.


Last edited by hoacker on Sun May 02, 2010 10:41 am; edited 1 time in total
Back to top
View user's profile Send private message
KayZee
Apprentice
Apprentice


Joined: 15 Oct 2003
Posts: 202
Location: Arlington, VA

PostPosted: Sat May 01, 2010 9:08 pm    Post subject: Reply with quote

In /etc/bind/named.conf you have to set your forward statements. I have these

Code:
forward only;
   forwarders {
      8.8.8.8;
      8.8.4.4;
   };


where 8.8.8.8 and 8.8.4.4 are Google's public resolvers. http://code.google.com/speed/public-dns/docs/using.html

This should resolve local names and forward on to the public resolvers anything it does not know.
Back to top
View user's profile Send private message
user
Apprentice
Apprentice


Joined: 08 Feb 2004
Posts: 216

PostPosted: Sat May 01, 2010 9:12 pm    Post subject: Re: DNS: Query different DNS for different subnets. How? Reply with quote

Hi hoacker,

hoacker wrote:
Hi there,
...
So, my goal is to configure the laptop to only query the local name server for local hosts and query the wireless router for all remote hosts. How can I do this? As I already wrote, I did a lot of reading today and tried quite a lot of different configuration. No luck so far.
...


how about dnsmasq and this option
Code:

# Add other name servers here, with domain specs if they are for                                                                                                                           
# non-public domains.                                                                                                                                                                       
#server=/localnet/192.168.0.1
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Sat May 01, 2010 9:41 pm    Post subject: Re: DNS: Query different DNS for different subnets. How? Reply with quote

Thanks for the answers.

KayZee wrote:
In /etc/bind/named.conf you have to set your forward statements.


Hm, doesn't this just instruct the local name server what name server to use? What if the local server cannot reach the forward name server? A quick try didn't solve my problem (what forward server do I have to enter anyway?)


user wrote:

how about dnsmasq and this option
Code:

# Add other name servers here, with domain specs if they are for                                                                                                                           
# non-public domains.                                                                                                                                                                       
#server=/localnet/192.168.0.1


I'll have a look at dnsmasq tomorrow, it's already late here...
Back to top
View user's profile Send private message
princeoliver
n00b
n00b


Joined: 29 Apr 2010
Posts: 4

PostPosted: Sun May 02, 2010 12:13 am    Post subject: Reply with quote

You can set up net-dns/pdnsd in your laptop with a configuration like this:

Code:
global {
        perm_cache=1000000;
        cache_dir="/var/cache/pdnsd";
        run_as="pdnsd";
        strict_setuid=on;
        server_ip = 127.0.0.1;
        min_ttl=1w;
        max_ttl=1w;
        neg_ttl=1h;
        status_ctl = on;
        paranoid=on;
        query_method=udp_only;
        timeout=2;
        neg_ttl=60;
}

server {
        label= "local";
        ip = 10.1.0.1;
        port=53;
        proxy_only=on;
        timeout=5;
        interval=ontimeout;
        caching=off;
        include=".local";
        include=".10.in-addr.arpa.";
        policy=excluded;
}

server {
        label= "Internet";
       ip = 8.8.8.8;
        port=53;
        proxy_only=off;
        timeout=5;
        interval=ontimeout;
        caching=on;
        exclude=".local";
        exclude=".10.in-addr.arpa.";
        policy=fqdn_only;
}


(and set /etc/resolv.conf nameserver to 127.0.0.1)

http://www.phys.uu.nl/~rombouts/pdnsd/doc.html
Back to top
View user's profile Send private message
hoacker
Guru
Guru


Joined: 04 Aug 2007
Posts: 505
Location: Bürstadt, Germany

PostPosted: Sun May 02, 2010 10:41 am    Post subject: Reply with quote

princeoliver wrote:
You can set up net-dns/pdnsd in your laptop


Pdnsd works for me! Thanks everyone!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum