Ddns josh
Ziel
Ein Rechner bezieht eine IP Adresse von einem DHCP Server. Er teilt diesem Server seinen Namen mit. Der DHCP Server soll den Namen und die IP Adresse an den Namerserver übermitteln, so das dieser sowohl einen A-Record als auch einen PTR Record eintragen kann.
BIND
Folgende Einstellungen werden am Nameserver BIND vorgenommen.
Gemeinsamer Schlüssel
Erstellen eines Pre Shared Key
- dnssec-keygen -a HMAC-MD5 -b 512 -n HOST vulkan.int
Es wurde die Datei vulkan.int.+xxx+xxxxx.private. erstellt
>secret ""Private-key-format: v1.2 >Algorithm: 157 (HMAC_MD5) >Key: testkey== >Bits: AAA=
Einträge in die /etc/bind/named.conf.local
in der neu erstellten Datei steht unter Key: der erstellt Key dieser muss nach named.conf.local kopiert werden hinter secret
key vulkan.int {
algorithm HMAC-MD5;
secret "testkey==";
};
Jezt werden noch in /etc/bind/named.conf.local die Zonen noch geändert
zone vulkan.int {
type master;
file "vulkan.int";
allow-update {
key vulkan.int;
};
};
zone "100.80.10.in-addr.arpa" {
type master;
file "100.80.10.in-addr.arpa";
allow-update {
key vulkan.int ;
};
};
Neustarten
- systemctl restart bind9
Testen
Nsupdate
- nsupdate -v
> key vulkan.int testkey== > server 10.80.100.10 > update delete schluri.vulkan.int > update add schluri.vulkan.int 300 A 10.80.100.141 > send
- STRG+D
Log
- tail -f /var/log/syslog | grep named
Sep 17 08:27:49 chris named[12124]: resolver priming query complete Sep 17 09:05:45 chris named[12124]: client @0x7f0638043c10 10.80.100.10#42869/key vulkan.int: signer "vulkan.int" approved Sep 17 09:05:45 chris named[12124]: client @0x7f0638043c10 10.80.100.10#42869/key vulkan.int: updating zone 'vulkan.int/IN': delete all rrsets from name 'schluri.vulkan.int' Sep 17 09:05:45 chris named[12124]: client @0x7f0638043c10 10.80.100.10#42869/key vulkan.int: updating zone 'vulkan.int/IN': adding an RR at 'schluri.vulkan.int' A 10.80.100.144 Sep 17 09:05:45 chris named[12124]: zone vulkan.int/IN: sending notifies (serial 2019091218)
DHCPD
Der test mit einem Script ddns basic
nun werden noch ein paar sachen in der config des DHCP geändert als erstes aktivieren wir die updates
> ddns-updates on;#
als nächstes kopieren wir den Key
>key "ddns-key" {
>algorithm HMAC-MD5;
>secret "pAY61K6RuV0TPfd0fTBMhA==";
>};
dazu muss der Key noch beiden Zonen zugewiesen werden
>zone cloud.net {
>primary 127.0.0.1;
>key "ddns-key";
>}
>zone 0.0.10.in-addr.arpa {
>primary 127.0.0.1;
>key "ddns-key";
>}
nun werden die zugehörige Domainnamen ind diedhcpd.conf eingetragen
>subnet 10.80.100.0 netmask 255.255.255.0 {
>range 10.80.100.101 10.80.100.150;
>#ddns-domainname "vulkan.int";
>option domain-name-servers 10.80.100.10, 10.80.100.11;
>option routers 10.80.100.1;
>}