LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Local name resolution with BIND (http://www.linuxquestions.org/questions/linux-software-2/local-name-resolution-with-bind-621483/)

rmarkin 02-15-2008 07:33 PM

Local name resolution with BIND
 
Hello,

System:
Ubuntu 7.04
BIND 9.3.4
DHCPD 3.0.4
hostname = nile
local ip = 192.168.1.1


Machine is functioning as the authoritative dhcp server, name server and gateway for my local network.

DHCP is working fine issuing leases etc.
BIND is working fine as a caching name server.

I would like to have BIND perform local name resolution but am unsure exactly how to implement it.

Config files are below:


named.conf
Code:

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};

// zone "com" { type delegation-only; };
// zone "net" { type delegation-only; };

// From the release notes:
//  Because many of our users are uncomfortable receiving undelegated answers
//  from root or top level domains, other than a few for whom that behaviour
//  has been trusted and expected for quite some length of time, we have now
//  introduced the "root-delegations-only" feature which applies delegation-only
//  logic to all top level domains, and to the root domain.  An exception list
//  should be specified, including "MUSEUM" and "DE", and any other top level
//  domains from whom undelegated responses are expected and trusted.
// root-delegation-only exclude { "DE"; "MUSEUM"; };

include "/etc/bind/named.conf.local";


named.conf.options
Code:

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

        // If there is a firewall between you and nameservers you want
        // to talk to, you might need to uncomment the query-source
        // directive below.  Previous versions of BIND always asked
        // questions using port 53, but BIND 8.1 and later use an unprivileged
        // port by default.

        // query-source address * port 53;

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders. 
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

acl "ourdomain-subnet" { 192.168.1.0/24; };

view "internal" {
        match-clients { "ourdomain-subnet"; };

        forwarders {
                206.13.31.12;
                68.94.157.1;
          };

         

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

        // By default, name servers should only perform recursive domain
        // lookups for their direct clients.  If recursion is left open
        // to the entire Internet, your name server could be used to
        // perform distributed denial of service attacks against other
        // innocent computers.  For more information on DDoS recursion:
        // http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-0987

        allow-recursion { "ourdomain-subnet"; };

        // If you have DNS clients on other subnets outside of your
        // server's "localnets", you can explicitly add their networks
        // without opening up your server to the Internet at large:
        // allow-recursion { localnets; 192.168.0.0/24; };

        // If your name server is only listening on 127.0.0.1, consider:
        allow-recursion { 127.0.0.1; };
};


named.conf.local
Code:

//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";


zone "homenetwork" {
        type master;
        file "/etc/bind/homenetwork.hosts";
        };

homenetwork.hosts
Code:

$ttl 38400
homenetwork.        IN        SOA        nile. (
                        1201594146
                        10800
                        3600
                        604800
                        38400 )
homenetwork.        IN        NS        nile.
amazon.homenetwork.        IN        A        192.168.1.5
nile.homenetwork.        IN        A        192.168.1.1
basic-server.homenetwork.        IN        A        192.168.1.10


dhcpd.conf
Code:

# DHCP configuration file
ddns-update-style interim;
ignore client-updates;

# Home network
subnet 192.168.1.0 netmask 255.255.255.0 {
        authoritative;
        option routers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option domain-name-servers 192.168.1.1;
        option ip-forwarding off;
        range dynamic-bootp 192.168.1.50 192.168.1.100;
        default-lease-time 21600;
        max-lease-time 43200;
        }

I would like the client machines on the network to be able to access any of the servers by simply using the hostname instead of the ip. Please let me know if there are any other files that you need to see.

Thank you in advance,
Robert

carltm 02-16-2008 08:06 AM

Put lines like this in your named.conf.local file in
the internal view section:

zone "mydomain.tld" {
type master;
file "/etc/bind/db.mydomain.tld";
};


Next copy /etc/bind/db.local to /etc/bind/db.mydomain.tld
and use this as a template to create your own zone file.

Of course, replace "mydomain.tld" with the domain name
you plan to use.


All times are GMT -5. The time now is 05:36 AM.