Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How to make my pc a DNS server in local network with no-internet access?

I have installed the two servers (dhcp & DNS) what i need is to make the dns dynamically configure the ips that dhcp server will offer to the terminals on the network. Thanks in advance

share|improve this question

marked as duplicate by Eliah Kagan, Jorge Castro, Tom Brossman, belacq, Mitch Sep 6 '12 at 4:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Can you provide an explanation of what you mean when you say you want to "dynamically configure" the ips that the dhcp server will offer? –  John S Gruber Sep 6 '12 at 3:44

1 Answer 1

up vote 2 down vote accepted

Install the needed packages:

sudo aptitude install bind9 isc-dhcp-server

Configure DNS:

sudo vi /etc/bind/named.conf.options

>   options {
>     directory "/var/cache/bind";
>     auth-nxdomain no;    # conform to RFC1035
>     forwarders {
>         192.168.100.1;
>         };

Dynamic Updating DNS:

sudo /usr/sbin/rndc-confgen -a

This will create a file named rndc.key, whose contents will look something like this:

  key "rndc-key" {
        algorithm hmac-md5;
        secret "idz+GGAJRtrqz4j4kZ3DjQ==";
  };

Creating DNS Zones_Forward Zone:

sudo vi /etc/bind/named.conf.local

  key "rndc-key" {
         algorithm hmac-md5;
        secret "idz+GGAJRtrqz4j4kZ3DjQ==";
  };

  zone "example.com" {
  type master;
  file "/etc/bind/db.example.com"; 
  };

DNS Zones population_Forward zone:

sudo cp /etc/bind/db.local /etc/bind/db.example.com
sudo vi /etc/bind/db.example.com

  key "rndc-key" {
         algorithm hmac-md5;
        secret "idz+GGAJRtrqz4j4kZ3DjQ==";
  };

  zone "example.com" {
  type master;
  file "/etc/bind/db.example.com"; 
  };

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

DNS Zones population_Reverse zone:

sudo cp /etc/bind/db.127 /etc/bind/db.192
sudo vi /etc/bind/db.192

  $TTL  604800
  @ IN  SOA ns.example.com. root.example.com. (
                  1     ; Serial
             604800     ; Refresh
              86400     ; Retry
            2419200     ; Expire
             604800 )   ; Negative Cache TTL
  ;
  @ IN  NS  ns.
  1 IN  PTR ns.example.com.
  2 IN  PTR ibr.example.com.

Now create links for the zone files in the /var/ directory

sudo ln -sf /etc/bind/db.example.com /var/lib/bind/
sudo ln -sf /etc/bind/db.example.com /var/cache/bind/
sudo ln -sf /etc/bind/db.192 /var/lib/bind/
sudo ln -sf /etc/bind/db.192 /var/cache/bind/

Configuring DHCP:

sudo vi /etc/dhcp/dhcpd.conf

 #GLOBAL OPTIONS 
  ddns-updates on;
   ddns-update-style interim;
  update-static-leases on;
  authoritative;
  key "rndc-key" {
        algorithm hmac-md5;
        secret "idz+GGAJRtrqz4j4kZ3DjQ==";
  };
  allow unknown-clients;
  use-host-decl-names on;
  default-lease-time 1814400; #21 days
  max-lease-time 1814400; #21 days
  log-facility local7;

  #Building DNS Zones
  zone    example.com. {
            primary localhost;
            key rndc-key;
    }
    zone 100.168.192.in-addr.arpa. {
            primary localhost;
            key rndc-key;
    }

  #Building LAN Scope
  subnet 192.168.100.0 netmask 255.255.255.0 {
  range 192.168.100.20 192.168.100.50;
  option subnet-mask 255.255.255.0;
  option routers 192.168.100.1;
  option domain-name-servers 192.168.100.1;
  option domain-name "example.com";
  ddns-domainname "example.com.";
  ddns-rev-domainname "in-addr.arpa.";
  }
share|improve this answer