Инструменты пользователя

Инструменты сайта


unix:dns-dhcp

DNS + DHCP

Генерируем ключ:

# dnssec-keygen -a HMAC_MD5 -b 128 -n USER DHCP_UPDATER
# ll K*
-rw-------  1 root  wheel    54B  5 дек 16:07 Kdhcp_updater.+157+28324.key
-rw-------  1 root  wheel   165B  5 дек 16:07 Kdhcp_updater.+157+28324.private
# cat Kdhcp_updater.+157+28324.key 
DHCP_UPDATER. IN KEY 0 3 157 TkFlLh/62W/JXFhrdJknzA==
# cat Kdhcp_updater.+157+28324.private 
Private-key-format: v1.3
Algorithm: 157 (HMAC_MD5)
Key: TkFlLh/62W/JXFhrdJknzA==
Bits: AAA=
Created: 20131205050716
Publish: 20131205050716
Activate: 20131205050716

Что то сгенерировалось.

Теперь правим dhcpd.conf

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "pu51.alx";
option domain-name-servers 192.168.0.254;
option routers 192.168.0.254;
option broadcast-address 192.168.0.255;
option netbios-name-servers 192.168.0.254;
option netbios-node-type 8;
option ntp-servers 192.168.0.254;

option local-pac-server code 252 = text;
option local-pac-server "http://wpad.pu51.alx/wpad.dat";

default-lease-time 432000;
max-lease-time 432000;

ddns-updates on;
update-static-leases on;
ddns-domainname "pu51.alx";
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
ddns-update-style interim;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# Наш ключ
key DHCP_UPDATER {
    algorithm hmac-md5;
    secret "TkFlLh/62W/JXFhrdJknzA==";
};

zone pu51.alx. {
    primary 127.0.0.1;
    key DHCP_UPDATER;
}

zone 0.168.192.in-addr.arpa. {
    primary 127.0.0.1;
    key DHCP_UPDATER;
}

###
### do windows-style proxy autoconfig:
### option local-proxy-config code 252 = text;
### ...
### subnet 192.168.0.0 netmask 255.255.255.0 {
###    range 192.168.0.20 192.168.0.30;
###    ...
###    option local-proxy-config "http://www.example.org/proxy.pac";
### }
###

subnet 192.168.0.0 netmask 255.255.255.0 {
#    range 192.168.0.200 192.168.0.210;
}

###################
#
# SERVER
#
host p92 {
    hardware ethernet 60:a4:4c:cd:45:ec;
    fixed-address 192.168.0.1;
}

Тепрь named.conf Начало конфига пропущу :) оно не интересно и стандартно. Обратите внимание, где лежат зоны динамического обновления… Они лежат там, где надо: в каталоге dynamic Именно в этот каталог демон named имеет разрешение на запись.

# Наш ключ
key "DHCP_UPDATER" {
    algorithm hmac-md5;
    secret "TkFlLh/62W/JXFhrdJknzA==";
};

zone "pu51.alx" {
    type master;
    file "../dynamic/pu51.alx";
    allow-update { key "DHCP_UPDATER"; };
    notify no;
};

zone "0.168.192.in-addr.arpa" {
    type master;
    file "../dynamic/pu51.alx.rev";
    allow-update { key "DHCP_UPDATER"; };
    notify no;
};


key "rndc-key" {
    algorithm hmac-md5;
    secret "9TrwQ0RDBGuEUgyU1vFtAQ==";
};

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

logging {
    channel update_debug {
        file "/var/log/named-update.log";
        severity debug 3;
        print-category yes;
        print-severity yes;
        print-time yes;
    };
    channel security_info {
        file "/var/log/named-auth.log";
        severity info;
        print-category yes;
        print-severity yes;
        print-time yes;
    };
    category update { update_debug; };
    category security { security_info; };
};

Заглянем в каталог dynamic:

# ll dynamic/
total 24
-rw-r--r--  1 bind  wheel   2,0k 19 дек 12:09 pu51.alx
-rw-r--r--  1 bind  wheel   6,4k 19 дек 11:55 pu51.alx.jnl
-rw-r--r--  1 bind  wheel     1k 20 дек 10:04 pu51.alx.rev
-rw-r--r--  1 bind  wheel     7k 20 дек 09:51 pu51.alx.rev.jnl

Видим, что в каталоге появились файлы журнала: .jnl - у нас все работает. Кроме того, если мы заглянем в файлик pu51.alx то увидим там динамически добавленные записи.

unix/dns-dhcp.txt · Последнее изменение: 2013/12/26 14:38 (внешнее изменение)