Aggiornamento dinamico dns di bind9 con dhcpd3: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Utilizzando dhcpd3 e bind9 è possibile far aggiornare i nomi dns di un pc automaticamente all'assegnazione dell'indirizzo in dhcp.
Utilizzando dhcpd3 e bind9 è possibile far aggiornare i nomi dns di un pc automaticamente all'assegnazione dell'indirizzo in dhcp.
'''ATTENZIONE ! SE SI USA DDNS NON SI POSSONO INSERIRE A RECORD STATICI NORMALMENTE.
OCCORRE FREEZARE LA ZONA, EDITARE IL FILE E UNFREEZARLA''':
sudo rndc freeze bp.galimberti.priv
sudoedit /etc/bind/bp.galimberti.priv.conf
sudo rndc unfreeze bp.galimberti.priv
sudo invoke-rc.d dhcp3-server restart
sudo invoke-rc.d bind9 restart
Vedi links:
*[http://ipucu.enderunix.org/view.php?id=446&lang=en (BIND) "journal rollforward failed: journal out of sync with zone" ERROR:]
*[http://osdir.com/ml/network.dns.bind9.user/2002-08/msg00030.html separation of dynamic from static zones: msg#00030 network.dns.bind9.user]
*[http://www.ops.ietf.org/dns/dynupd/secure-ddns-howto.html Secure dynamic DNS howto]


== Installazione pacchetti ==
== Installazione pacchetti ==
Line 100: Line 117:
}
}
</pre>
</pre>
Il nome dell'host aggiunto nel DNS viene così determinato:
* Forzato con il parametro ddns-hostname:
<pre>
host bpdsp34 {
        ## te1
        hardware ethernet 00:30:05:B7:41:4D;
        fixed-address 192.168.27.34;
        option host-name "bpdsp34";
        ddns-hostname "bpdsp34";
        }
</pre>
* Derivato dal nome host mandato dal Client


Riavviare dhcpd3
Riavviare dhcpd3
Line 121: Line 153:


* [http://www.debian-administration.org/articles/343 Debian Administration :: Configuring Dynamic DNS & DHCP on Debian Stable:]
* [http://www.debian-administration.org/articles/343 Debian Administration :: Configuring Dynamic DNS & DHCP on Debian Stable:]
*[https://lists.isc.org/pipermail/dhcp-users/2008-September/007105.html DDNS update for hosts with fixed address]

Latest revision as of 16:13, 15 February 2010

Utilizzando dhcpd3 e bind9 è possibile far aggiornare i nomi dns di un pc automaticamente all'assegnazione dell'indirizzo in dhcp.


ATTENZIONE ! SE SI USA DDNS NON SI POSSONO INSERIRE A RECORD STATICI NORMALMENTE.

OCCORRE FREEZARE LA ZONA, EDITARE IL FILE E UNFREEZARLA:

sudo rndc freeze bp.galimberti.priv
sudoedit /etc/bind/bp.galimberti.priv.conf
sudo rndc unfreeze bp.galimberti.priv
sudo invoke-rc.d dhcp3-server restart
sudo invoke-rc.d bind9 restart

Vedi links:


Installazione pacchetti

Copiare le eventuali configurazioni di bind e dhcpd.

Rimuoverli:

apt-get remove --purge bind dhcp

Installare le nuove versioni:

apt-get install install bind9 dhcp3-server

Configurazione di bind9

Generare una chiave per rndc:

rndc-confgen -a

Inserire la direttiva che consente l'update di bind9 in /etc/bind/named.conf.local:

controls {
        inet 127.0.0.1 allow {localhost; } keys { "rndc-key"; };
};


Creare le zone dirette ed inverse, e customizzarle come segue in /etc/named.conf.local

// Add local zone definitions here.
zone "cliente.priv" {
        type master;
        file "/etc/bind/cliente.priv.hosts";
        allow-update { key "rndc-key"; };
        notify yes;
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/db.192.168.21";
        allow-update { key "rndc-key"; };
        notify yes;
};

include "/etc/bind/rndc.key";

Modifica dei diritti di /etc/bind

Bind dovrà scrivere dei files dei lease dinamici, quindi rendere scrivibile dal gruppo bind la diretory:

chmod -R g+rwX /etc/bind; chown -R :bind /etc/bind

Riavviare bind:

/etc/init.d/bind9 stop;  /etc/init.d/bind9 start

Configurazione di dhcpd3

Modificare il file di configurazione /etc/dhcp3/dhcpd.conf come segue:

# Specifiche per il DDNS
server-identifier           cliserver;
ddns-updates                on;
ddns-update-style           interim;
ddns-domainname             "cliente.priv.";
ddns-rev-domainname         "in-addr.arpa.";
ignore                      client-updates;
include                     "/etc/bind/rndc.key";
update-static-leases        on;

# Specifiche per il DDNS
zone cliente.priv. {
    primary 127.0.0.1;
    key rndc-key;
}

All'interno della definizione della subnet, inserire:

subnet 192.168.21.0 netmask 255.255.255.0 {
...
        # Specifiche per il DDNS
        zone    21.168.192.in-addr.arpa. {
                primary 192.168.21.254;
                key             "rndc-key";
        }

        # Specifiche per il DDNS
        zone    localdomain. {
                primary 192.168.21.254;
                key             "rndc-key";
        }
...
}

Il nome dell'host aggiunto nel DNS viene così determinato:

  • Forzato con il parametro ddns-hostname:
host bpdsp34 {
        ## te1
        hardware ethernet 00:30:05:B7:41:4D;
        fixed-address 192.168.27.34;
        option host-name "bpdsp34";
        ddns-hostname "bpdsp34";
        }
  • Derivato dal nome host mandato dal Client

Riavviare dhcpd3

sudo invoke-rc.d dhcp3-server stop;  sudo invoke-rc.d dhcp3-server start

Troubleshooting

ATTENZIONE:

Se si rigenera la chivae rndc, occorre riavviare sia bind che dhcpd, altrimenti si ottiene l'errore:

named[30593]: client 127.0.0.1#49087: request has invalid signature: TSIG rndc-key: tsig verify failure (BADKEY)

Se invece si dimentica di settare i diritti sulla /etc/bind, si ottiene l'errore:

named[30901]: db.rdu90.com.jnl: create: permission denied


Riferimenti