HOWTO: Linux multihomed dns client


 
Thread Tools Search this Thread
Special Forums IP Networking HOWTO: Linux multihomed dns client
# 1  
Old 04-01-2010
HOWTO: Linux multihomed dns client

The Linux resolver queries all nameservers in the order they are listed in /etc/resolver.conf.
If a nameserver times out, it advances on to the following nameserver.
But, if a nameserver returns "not found" (NXDOMAIN) it stops.

This behaviour is problematic when you need to resolve names from the local domain along with names from the Internet.
Suppose you have two network interfaces, one for the private local area network (network interface card) and one for the public Internet (for example a vpn to a provider like Relakks). If you put the public nameserver first in resolver.conf, then all names in the local domain will not be resolved. If you put the private nameserver first, public site names will not be resolved.
The standard solution would be that the private nameserver infrastructure be able to resolve public names (i.e. do a recursive query for domains outside the local zone); but sometimes you find yourself attached to a private network that does not allow Internet access (or allow it only through a http proxy), hence the local nameservers do not have any reason to provide resolution for external names.

Windows has a concept in which a nameserver pertains to a particular network interface, therefore you can associate your ISP's nameserver to the vpn and the local nameserver to the network card. When the resolver is asked for the address corresponding to some name, it starts by querying the nameserver(s) associated to the preferred adapter (which happens to be the first in the "binding order"), failing that (by timeout or not-found) it advances to query nameservers associated to other adapters. In the end, any name which is resolvable by at least one involved nameserver will be resolved.

Linux has no built in rules to manage such a scenario.
I did much googling but found no answer about this problem.

I had a feeling that BIND (the Berkeley Internet Name Domain software, which is the standard nameserver daemon for Linux) could provide a solution, and indeed I found that the following works.

All work must be done as root.

Install bind9 package:
debian like Linux: aptitude install bind9
redhat like Linux: yum -y install bind9

You now have a local caching only nameserver, that is it does recursive queries for anything but the local host name. As it stands, it cannot resolve private domain names because it asks Internet dns root servers.

Save a copy of /etc/bind/named.conf and replace the original with:
Code:
options {
    directory "/var/cache/bind";

    forward only;

    forwarders {
        w.x.y.z; // your private nameserver
        8.8.8.8; // google-public-dns-a.google.com
    };

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};

That is, you have to add directives forward and forwarders, providing ip addresses for public and private nameservers.

Restart bind daemon:
service bind9 restart

Save a copy of /etc/resolv.conf and replace the original with:
Code:
nameserver 127.0.0.1

This configuration somehow behaves like the Windows resolver, in that it does not stop at the first nameserver returning not-found.

As in the Windows case tough, sometimes some time is wasted asking to the wrong nameserver.
We can do better.

Let consider this version of named.conf

Code:
options {
    directory "/var/cache/bind";

    forward only;

    forwarders {
        8.8.8.8; // google-public-dns-a.google.com
    };

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};

zone "your.domain" {
        type forward;
        forwarders {
                w.x.y.z; // your private nameserver
        };
};

This configuration has the benefit that for names ending with your.domain the daemon does not bother to ask the public nameserver, and vice-versa.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

DNS client added to DNS server but not working

Hi, We have built a new server (RHEL VM)and added that IP/hostname into dns zone configs file on DNS server (Solaris 10). Reloaded the configuration using and added nameserver into resolv.conf on client. But when I am trying nslookup, its not getting resolved. The nameserver is not able to... (8 Replies)
Discussion started by: snchaudhari2
8 Replies

2. Solaris

DNS client - what exactly it is

Hi all, I always thought DNS server = provide DNS response (host to ip / ip to host) to DNS client (which send DNS resolve request). So in my solaris 10 box, i setup /etc/resolv/conf, /etc/nsswitch.conf (added in dns) etc. Yes, i am able to dig and nslookup. But.. am i a DNS client ? ... (5 Replies)
Discussion started by: javanoob
5 Replies

3. IP Networking

HOWTO: Linux multihomed dns client - reverse lookup

The following thread is closed: 133552-howto-linux-multihomed-dns-client (Sorry I am not allowed to post URLs) Therefore I write this append in an own thread. The HOWTO in the referenced thread helped me a lot and I only want to append how to make reverse lookup working for a local zone: ... (0 Replies)
Discussion started by: scheruga
0 Replies

4. Solaris

dns client not working

Hi All, I have configured linux server as local dns server (practice level). I have given the IP and hostname details in /etc/hosts -bash-3.00# cat /etc/hosts # # Internet host table # ::1 localhost 127.0.0.1 localhost 192.168.1.78 dummy.set.com loghost 192.168.1.57 cent.set.com #... (3 Replies)
Discussion started by: vaibhav.kanchan
3 Replies

5. UNIX for Advanced & Expert Users

DNS server choice: Windows DNS vs Linux BIND

I'd like to get some opnions on choosing DNS server: Windows DNS vs Linux BIND comparrsion: 1) managment, easy of use 2) Security 3) features 4) peformance 5) ?? I personally prefer Windows DNS server for management, it supports GUI and command line. But I am not sure about security... (2 Replies)
Discussion started by: honglus
2 Replies

6. Solaris

Solaris DNS Client For Microsoft DNS Server

hey guys, how to add soalris box as a microsoft DNS Client ? and how to register in the microsoft DNS ?? i managed to query from the DNS server after adding /etc/resolve.conf and editing /etc/nsswitch.conf but i need to register the soalris server (dns Client) into Microsoft DNS automatically.... (3 Replies)
Discussion started by: mduweik
3 Replies

7. IP Networking

Multihomed DNS Clients?

I'm not sure it that's the right term for what I'm asking about, but it's the best I could come up with. Here is my situation... I'm setting up a network using OpenVPN. The clients I'm setting up will need to be able to access their own DNS servers (to resolve internal names at their location)... (4 Replies)
Discussion started by: deckard
4 Replies

8. UNIX for Advanced & Expert Users

DNS client nslookup

Hello, I just got done setting up a DNS server and a client. However, when I do an nslookup with just the hostname, I got this output: Microsoft Windows 2000 (C) Copyright 1985-2000 Microsoft Corp. C:\Documents and Settings\dev9>nslookup dev9 Server: webdev.testsurgemail.com Address:... (3 Replies)
Discussion started by: xnightcrawl
3 Replies

9. Programming

Multihomed Client

Hi, I am writing a socket program at the moment that uses both of the clients network interfaces. The program tries to create two socket connections to the server over a LAN connection and a GPRS connection. I have tried to update the routing table using the route command but that proved... (0 Replies)
Discussion started by: mhynes
0 Replies

10. IP Networking

Howto configure AIX DHCP Client ?

I use DHCP on my AIX box at home . I want to connect to my Cable ISP as a DHCP Client . the thing I did was this : smit Communications Applications and Services TCP/IP Use DHCP for TCPIP Configuration and Startup "Select the interface you want to use" en0 "Enter a hostname" OK after... (3 Replies)
Discussion started by: zumbi
3 Replies
Login or Register to Ask a Question