Как в DNS прописать два образа одной и той же зоны для внутренней и внешней сети.
view "internal" {
match-clients { 192.168.0.0/16; };
zone "radmin.com.ua" {
type master;
file "radmin.com.ua.int";
};
};
view "external" {
match-clients { any; };
zone "radmin.com.ua" {
type master;
file "radmin.com.ua.ext";
};
};
Ограничения числа одновременных соединений к named
options {
directory "/etc/namedb";
recursive-clients 5000;
tcp-clients 500;
};
Как разрешить полный трансфер DNS зоны только для избранных серверов.
zone "domen.co.ua" {
type master;
allow-transfer { 1.2.3.4; 1.2.3.5; 1.2.3.6;};
file "radmin.com.ua";
}
Как запретить Bind показывать свою версию для внешнего мира.
Узнать версию можно через:
dig @ns1.radmin.com.ua version.bind chaos txt
Чтобы запретить, нужно в options блоке named.conf прописать:
options {
...
version "";
};
Как запретить рекурсивные запросы через DNS сервер для чужих клиентов
Закрываем openDNS
acl localnet { 192.168.1.0/24; 10.0.1.0/24; };
options {
allow-recursion {localnet; 192.168.2.0/24};
};
Оптимизация работы DNS резолвера, случайный выбор NS
В /etc/resolv.conf:
options attempts=2, timeout=2, rotate
,где attempts - число попыток посылки запроса к серверу.
timeout - таймаут запроса (по умолчанию 5 сек.)
rotate случайный выбор nameserver из списка, а не опрос по порядку.
timeout - таймаут за который сервер должен успеть ответить.
Для отладки удобно использовать "options debug"
Настройка динамического обновления DNS зон
Генерируем ключи:
dnssec-keygen -a HMAC-MD5 -b 512 -n USER radmin.com.ua
Настройки сервера:
/etc/named.conf:
include "keys.conf";
......
zone "radmin.com.ua" {
type master;
file "radmin.com.ua.zone";
update-policy {
grant laptop.radmin.com.ua. name laptop.bar44.com. A TXT;
grant foo22.radmin.com.ua. subdomain radmin.com.ua. ANY;
};
# или
#allow-update {
# key foo22.radmin.com.ua.
#};
};
/etc/namedb/keys.conf:
key foo22.radmin.com.ua. {
algorithm HMAC-MD5;
secret "секретный ключ";
};
Для обновления зоны:
nsupdate -k Kfoo22.radmin.com.ua.+157+12505.private -v cmd_file.txt
Пример cmd_file.txt:
server ns.radmin.com.ua
zone radmin.com.ua
update delete somehost.radmin.com.ua. A
update add somehost.radmin.com.ua. 86400 A 10.10.10.1
show
send
Пример ведения расширенных логов в named
#>> named.conf
logging {
channel default_log {
file "/var/log/dns.log";
# severity info;
severity notice;
print-time yes;
print-category yes;
print-severity yes;
};
channel more_log {
file "/var/log/dns_more.log";
# severity info;
severity notice;
print-time yes;
print-category yes;
print-severity yes;
};
category queries { default_log;};
category xfer-in { default_log; };
category xfer-out { default_log; };
category security { more_log; };
category resolver { more_log; };
category client { more_log; };
category unmatched { more_log; };
category default { more_log; };
category database { more_log; };
};
Детальное ведение логов сервиса ДНС (BIND9)
#####################################################################################
# Logging Configuration
#
logging {
channel default_log {
file "/var/named/default.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel security_log {
file "/var/named/security.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel xfer-in_log {
file "/var/named/xfer-in.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel xfer-out_log {
file "/var/named/xfer-out.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel notify_log {
file "/var/named/notify.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel update_log {
file "/var/named/update.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel query_log {
file "/var/named/query.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel lame-servers_log {
file "/var/named/lame-servers.log" versions 3 size 100M;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
category default { default_log; };
category security { security_log; };
category xfer-in { xfer-in_log; };
category xfer-out { xfer-out_log; };
category notify { notify_log; };
category update { update_log; };
category queries { query_log; };
category lame-servers { lame-servers_log; };
};