LINUX.ORG.RU
ФорумAdmin

Проблема с настройкой DNS сервера на CentOS 7

 , ,


0

1

Всем добрый вечер. Настроил bind сервер на centos7 в virtualbox для внутренней сети. На самом сервере все отлично работает:

Address:        192.168.2.1#53
Name:   lan
Address: 192.168.2.5
Name:   lan
Address: 192.168.10.20
Name:   lan
Address: 192.168.2.1

На клиентских машинах получаю ответ(обе centos7):

Address:        192.168.2.1#53
** server can't find lan: REFUSED

Записи в логах:

client @0x7fde940bab20 192.168.10.20#45581 (3.centos.pool.ntp.org.local): query (cache) '3.centos.pool.ntp.org.local/AAAA/IN' denied
client @0x7fde940bab20 192.168.2.5#43971 (lan.lan): query 'lan.lan/A/IN' denied
client @0x7fde940bab20 192.168.2.5#35063 (lan): query 'lan/A/IN' denied

Конфигурационный файл named.conf:

        listen-on port 53 { 127.0.0.1; 192.168.2.1;};
#       listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
        allow-query     { localhost; 192.168.2.0/24; 192.168.10.0/24; };
        allow-query-cache { localhost; 192.168.2.0/24; 192.168.10.0/24; };
        forwarders { 8.8.8.8; };
        /*
         - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
         - If you are building a RECURSIVE (caching) DNS server, you need to enable
           recursion.
         - If your recursive DNS server has a public IP address, you MUST enable access
           control to limit queries to your legitimate users. Failing to do so will
           cause your server to become part of large scale DNS amplification
           attacks. Implementing BCP38 within your network would greatly
           reduce such attack surface
        */
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.root.key";

        managed-keys-directory "/var/named/dynamic";

        pid-file "/run/named/named.pid";
        session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "lan" IN {
type master;
file "forward.lan";
allow-update { none; };
};
zone "168.192.in-addr.arpa" IN {
type master;
file "reverse.lan";
allow-update { none; };
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

Конфиг forward.lan:

$TTL 86400
@   IN  SOA     router.lan. root.lan. (
2011071001  ;Serial
3600        ;Refresh
1800        ;Retry
604800      ;Expire
86400       ;Minimum TTL
)
@       IN  NS          router.lan.
@       IN  A           192.168.2.1
@       IN  A           192.168.2.5
@       IN  A           192.168.10.20
router       IN  A   192.168.2.1
web    IN  A   192.168.2.5
db          IN  A   192.168.10.20

конфиг reverse.lan

$TTL 86400
@   IN  SOA     router.lan. root.lan. (
2011071001  ;Serial
3600        ;Refresh
1800        ;Retry
604800      ;Expire
86400       ;Minimum TTL
)
@       IN  NS          router.lan.
@       IN  PTR         lan.
router       IN  A   192.168.2.1
web    IN  A   192.168.2.5
db          IN  A   192.168.10.20
1.2     IN  PTR         router.lan.
5.2     IN  PTR         web.lan.
20.10     IN  PTR         db.lan.

Все правильно. Ты запрашиваешь с клиента ресолвинг внешнего адреса. Это подразумевает рекурсивный запрос во вне. На это нужно разрешение.

Добавь

allow-query     { lan_hosts; };
    allow-recursion { lan_hosts; };
AVL2 ★★★★★
()
Ответ на: комментарий от AVL2

теперь еще проблема появилась, если с сервера делаю nslookup ya.ru, то все ок. Но на клиентах ** server can’t find ya.ru: NXDOMAIN.

Endryu
() автор топика
Ответ на: комментарий от Endryu

Посмотри в логе, что там не нравится named.

Посмотри в /etc/resolv.conf на сервере. Он точно использует себя, а не гугл напрямую?

И на клиентах посмотри, что пишет ipconfig /all может там другой сервер днс указан?

AVL2 ★★★★★
()
Ответ на: комментарий от AVL2

лог named:

client @0x7f6fc80a9b30 192.168.2.5#46886 (ya.ru): query (cache) 'ya.ru/A/IN' denied
client @0x7f6fc80a9b30 192.168.2.5#41512 (ya.ru): query (cache) 'ya.ru/A/IN' denied

/etc/resolv.conf на сервере:

search lan
nameserver 192.168.2.1

на клиентах dns тоже 192.168.2.1, вообще не могу понять, в чем проблема. forwarders же указан

Endryu
() автор топика
Ответ на: комментарий от Endryu

forwarders тут не причем.

Все тот же отказ в обслуживании клиентов.

Что в итоге вышло в конфиге?

Директивы allow*

AVL2 ★★★★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.