LINUX.ORG.RU
решено ФорумAdmin

Bind9 + Apache2 Настройка DNS-сервера

 , , ,


0

1

Здравствуйте. Хочу настроить локальный сайт для сети, но не могу правильно настроить dns-сервер на ubuntu 16.04.
Доменное имя: dev.org
Название сайта: local-site.dev.org
IP сервера: 192.168.1.52
С изменением файла /etc/hosts все работает, но хотелось бы через dns
Вируальный хост на apache:

sudo cat /etc/apache2/sites-available/local-site.dev.org.conf
<VirtualHost 192.168.1.52:80>
ServerName local-site.dev.org
ServerAlias www.local-site.dev.org
ServerAdmin antoxa.yu@mail.ru
DocumentRoot /var/www/local.host.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Настройки dns-сервера:
sudo cat /etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

zone "dev.org"{
type master;
file "/etc/bind/db.host.com";
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "/etc/bind/db.192";
};
В named.conf.local прописано то же самое без indlud'ов.

sudo cat /etc/bind/named.conf.options
achl "home" {192.168.1.0/24; 127.0.0.1;};
options {
directory "/var/cache/bind";
auth-nxdomain no;
dnssec-validation auto;
allow-transfer{none;};
listen-on-v6 { none; };
allow-query{"home";};
recursion yes;
forwarders {
192.168.1.52;
8.8.8.8;
8.8.4.4;
};
};
sudo cat /etc/bind/db.host.com
$TTL 604800
@ IN SOA local-site. admin.local-site.dev.org. (
2015012801 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expiry
604800 ) ; Negative Cache TTL
;
dev.org. IN NS local-site.
local-site.dev.org. IN A 192.168.1.52
sudo cat /etc/bind/db.192
$TTL 604800
@ IN SOA ns1.local-site.dev.org. admin.local-site.dev.org. (
20141126 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS local-site.
1.0.0 IN PTR local-site.dev.org.

Надеюсь на вашу помощь.


Как-то странно вы все это наконфигурили. Почему бы не нарисовать что-то вроде

$TTL 604800
dev.org IN SOA ns.dev.org. admin.dev.org. (
2017040501 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expiry
604800 ) ; Negative Cache TTL

        IN NS ns.dev.org.
        IN A  192.168.1.52
ns      IN A  192.168.1.52 (или какой там ip у dns-сервера)
www     IN A  192.168.1.52
araks ★★
()
Ответ на: комментарий от araks

Я переправил. Похожие конфиги были раньше. Но на сайт, к сожалению, не заходит. Может где-то named.conf или named.conf.local ошибка? Или нужно в файле resolv.conf добавить ip dbs-сервера, там сейчас только 127.0.0.1?

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

Я пробовал пока только с сервера зайти. С клиентов пока не пытался. При host пишет, что local-site.dev.org not found: 3

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

[BASH] ; «» DiG 9.10.3-P4-Ubuntu «» dev.org any +trace ;; global options: +cmd ;; Received 28 bytes from 127.0.0.1#53(127.0.0.1) in 2 ms [/BASH]

dig local-site.dev.org any +trace говорит то же самое

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

Что в логах бинда после рестарта? Такое ощущение, что бинд не может загрузить зону. Кстати, резолв на другие адреса идет? 192.168.1.52; из forwarders уберите, он там не нужен.

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

Я не знаю, правильно ли я пытался посмотреть логи, но система мне отказала в просмотре:

sudo rndc flush # all entries
rndc: connect failed: 127.0.0.1#953: connection refused
Из forwarders убрал.

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

Это уже хорошо, значит bind робит норм. Добавьте логирование, как указано тут - https://wiki.debian.org/Bind9#File_.2Fetc.2Fbind.2Fnamed.conf.log Там же, кстати, и настройки rndc описаны.

Секцию logging можно приткнуть в любой из конфигов, какой больше нравится.

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

Так, секцию logging поставил, как написано. Перезапустил bind, попробовал сделать dig +trace, но в файле bind.log и других, которые написаны в logging, ничего не записано. rndc пока не стал пробовать настроить. Права на запись в файлы логов выдал перед перезапуском и сделал include «/etc/bind/named.conf.log»; в named.conf.local.

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

В syslog очень много всего. После перезапуска bind скопировал то, что было в одних из последних сообщений. Заранее извиняюсь, если скопировал не то, что нужно. А messages пустой.

Apr 6 00:26:42 client-VirtualBox gnome-session[2930]: (zeitgeist-datahub:3376): Gtk-WARNING **: Attempting to read the recently used resources file at '/home/client/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/client/.local/share/recently-used.xbel': Permission denied.
Apr 6 00:26:45 client-VirtualBox gnome-session[2930]: (zeitgeist-datahub:3376): Gtk-WARNING **: Attempting to read the recently used resources file at '/home/client/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/client/.local/share/recently-used.xbel': Permission denied.
Apr 6 00:26:48 client-VirtualBox gnome-session[2930]: (zeitgeist-datahub:3376): Gtk-WARNING **: Attempting to read the recently used resources file at '/home/client/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/client/.local/share/recently-used.xbel': Permission denied.
Apr 6 00:26:52 client-VirtualBox systemd[1]: Stopped BIND Domain Name Server.
Apr 6 00:26:52 client-VirtualBox systemd[1]: Started BIND Domain Name Server.
Apr 6 00:26:52 client-VirtualBox named[3437]: starting BIND 9.10.3-P4-Ubuntu <id:ebd72b3> -f -u bind
Apr 6 00:26:52 client-VirtualBox named[3437]: built with '--prefix=/usr' '--mandir=/usr/share/man' '--libdir=/usr/lib/x86_64-linux-gnu' '--infodir=/usr/share/info' '--sysconfdir=/etc/bind' '--localstatedir=/' '--enable-threads' '--enable-largefile' '--with-libtool' '--enable-shared' '--enable-static' '--with-openssl=/usr' '--with-gssapi=/usr' '--with-gnu-ld' '--with-geoip=/usr' '--with-atf=no' '--enable-ipv6' '--enable-rrl' '--enable-filter-aaaa' '--enable-native-pkcs11' '--with-pkcs11=/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so' 'CFLAGS=-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -fno-strict-aliasing -fno-delete-null-pointer-checks -DNO_VERSION_DATE' 'LDFLAGS=-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 -DDIG_SIGCHASE'
Apr 6 00:26:52 client-VirtualBox named[3437]: —--------------------------------------------------
Apr 6 00:26:52 client-VirtualBox named[3437]: BIND 9 is maintained by Internet Systems Consortium,
Apr 6 00:26:52 client-VirtualBox named[3437]: Inc. (ISC), a non-profit 501(c)(3) public-benefit
Apr 6 00:26:52 client-VirtualBox named[3437]: corporation. Support and training for BIND 9 are
Apr 6 00:26:52 client-VirtualBox named[3437]: available at https://www.isc.org/support
Apr 6 00:26:52 client-VirtualBox named[3437]: —--------------------------------------------------
Apr 6 00:26:52 client-VirtualBox named[3437]: adjusted limit on open files from 4096 to 1048576
Apr 6 00:26:52 client-VirtualBox named[3437]: found 1 CPU, using 1 worker thread
Apr 6 00:26:52 client-VirtualBox named[3437]: using 1 UDP listener per interface
Apr 6 00:26:52 client-VirtualBox named[3437]: using up to 4096 sockets
Apr 6 00:26:52 client-VirtualBox named[3437]: loading configuration from '/etc/bind/named.conf'
Apr 6 00:26:52 client-VirtualBox named[3437]: /etc/bind/named.conf.options:1: unknown option 'achl'
Apr 6 00:26:52 client-VirtualBox named[3437]: /etc/bind/named.conf.local:9: missing ';' before 'zone'
Apr 6 00:26:52 client-VirtualBox named[3437]: loading configuration: failure
Apr 6 00:26:52 client-VirtualBox named[3437]: exiting (due to fatal error)
Apr 6 00:26:52 client-VirtualBox systemd[1]: bind9.service: Main process exited, code=exited, status=1/FAILURE
Apr 6 00:26:52 client-VirtualBox rndc[3453]: rndc: connect failed: 127.0.0.1#953: connection refused
Apr 6 00:26:52 client-VirtualBox systemd[1]: bind9.service: Control process exited, code=exited status=1
Apr 6 00:26:52 client-VirtualBox systemd[1]: bind9.service: Unit entered failed state.
Apr 6 00:26:52 client-VirtualBox systemd[1]: bind9.service: Failed with result 'exit-code'.

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

Так вот же

Apr 6 00:26:52 client-VirtualBox named[3437]: /etc/bind/named.conf.options:1: unknown option 'achl'
Apr 6 00:26:52 client-VirtualBox named[3437]: /etc/bind/named.conf.local:9: missing ';' before 'zone'
Apr 6 00:26:52 client-VirtualBox named[3437]: loading configuration: failure
Apr 6 00:26:52 client-VirtualBox named[3437]: exiting (due to fatal error)

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

Да, я это подправил, но все-равно не работает. Теперь выдает вот такую картину.

8.E.F.IP6.ARPA
Apr 6 00:45:05 client-VirtualBox named[22620]: automatic empty zone: 9.E.F.IP6.ARPA
Apr 6 00:45:05 client-VirtualBox named[22620]: automatic empty zone: A.E.F.IP6.ARPA
Apr 6 00:45:05 client-VirtualBox named[22620]: automatic empty zone: B.E.F.IP6.ARPA
Apr 6 00:45:05 client-VirtualBox named[22620]: automatic empty zone: 8.B.D.0.1.0.0.2.IP6.ARPA
Apr 6 00:45:05 client-VirtualBox named[22620]: automatic empty zone: EMPTY.AS112.ARPA
Apr 6 00:45:05 client-VirtualBox named[22620]: configuring command channel from '/etc/bind/rndc.key'
Apr 6 00:45:05 client-VirtualBox systemd[1]: bind9.service: Main process exited, code=exited, status=1/FAILURE
Apr 6 00:45:05 client-VirtualBox named[22620]: command channel listening on 127.0.0.1#953
Apr 6 00:45:05 client-VirtualBox named[22620]: configuring command channel from '/etc/bind/rndc.key'
Apr 6 00:45:05 client-VirtualBox named[22620]: command channel listening on ::1#953
Apr 6 00:45:05 client-VirtualBox named[22620]: isc_stdio_open '/var/log/update_debug.log' failed: permission denied
Apr 6 00:45:05 client-VirtualBox named[22620]: configuring logging: permission denied
Apr 6 00:45:05 client-VirtualBox named[22620]: loading configuration: permission denied
Apr 6 00:45:05 client-VirtualBox named[22620]: exiting (due to fatal error)
Apr 6 00:45:05 client-VirtualBox rndc[22642]: rndc: connect failed: 127.0.0.1#953: connection refused
Apr 6 00:45:05 client-VirtualBox systemd[1]: bind9.service: Control process exited, code=exited status=1
Apr 6 00:45:05 client-VirtualBox systemd[1]: bind9.service: Unit entered failed state.
Apr 6 00:45:05 client-VirtualBox systemd[1]: bind9.service: Failed with result 'exit-code'.

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

После попытки сделать dig local-site.dev.org + trace В syslog было дописано:

Apr 6 00:45:08 client-VirtualBox gnome-session[2930]: (zeitgeist-datahub:3376): Gtk-WARNING **: Attempting to read the recently used resources file at '/home/client/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/client/.local/share/recently-used.xbel': Permission denied.
Apr 6 00:49:33 client-VirtualBox gnome-session[2930]: (zeitgeist-datahub:3376): Gtk-WARNING **: Attempting to read the recently used resources file at '/home/client/.local/share/recently-used.xbel', but the parser failed: Failed to open file '/home/client/.local/share/recently-used.xbel': Permission denied.

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

Это все не то

Apr 6 00:45:05 client-VirtualBox named[22620]: isc_stdio_open '/var/log/update_debug.log' failed: permission denied
Apr 6 00:45:05 client-VirtualBox named[22620]: configuring logging: permission denied
Apr 6 00:45:05 client-VirtualBox named[22620]: loading configuration: permission denied
Положите лучше логи куда-нибудь в /tmp, все равно логи нужны только временно, потом отключите.

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

Вчера ответить не мог, извините. После нескольких поправок выдает, что зоны загружены нормально. Доступ на сайт появился с dev.org, что очень хорошо, но с local-site.dev.org его нет. Пробовал исправить файл db.host.com, добавив везде local-site.dev.org вместо dev.org, но это не помогло. Сейчас пока оставил файл в прошлом состоянии.

$TTL 604800
@ IN SOA ns.dev.org. admin.dev.org. (
2017040501 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expiry
604800 ) ; Negative Cache TTL

@ IN NS ns.dev.org.
@ IN A 192.168.1.52
ns IN A 192.168.1.52
www IN A 192.168.1.52

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

Вот dig + trace:

dig local-site.dev.org +trace

; «» DiG 9.10.3-P4-Ubuntu «» local-site.dev.org +trace
;; global options: +cmd
. 83473 IN NS b.root-servers.net.
. 83473 IN NS h.root-servers.net.
. 83473 IN NS j.root-servers.net.
. 83473 IN NS c.root-servers.net.
. 83473 IN NS g.root-servers.net.
. 83473 IN NS i.root-servers.net.
. 83473 IN NS m.root-servers.net.
. 83473 IN NS l.root-servers.net.
. 83473 IN NS e.root-servers.net.
. 83473 IN NS f.root-servers.net.
. 83473 IN NS a.root-servers.net.
. 83473 IN NS k.root-servers.net.
. 83473 IN NS d.root-servers.net.
. 156408 IN RRSIG NS 8 0 518400 20170417140000 20170404130000 14796 . gGjFLXhzHJwbZWLvtMejlmugnBrCDfGd4DMHkBtWfRnddEIdzc3ynQAF eFibAkcT5Ni7wVdBc24E0u3hyVvIDpf1nG334M1ZDUThGrCziY4lgkIE 3NQpYHUtx1zbPwJaxFjWrkuM5JUewNZAi7ggc278k4TtEVVrXAhxtEBi j0vgA718OA2wI9goMV8A6AwIKHy5oyFj6UDTCFKInFRP/zpsjFpQnPIK pgijxiEY0H2SMG8qiPX5Yx/FqBJewOiVhQplX4mXN6Nv9IWKlZ/E91Gk R9toe6MIb1TeYNFt2/2gi7kkQJ8LpdE+97PePjW1B8u+m/9LmocUrren D1i9fQ==
;; Received 1136 bytes from 127.0.0.1#53(127.0.0.1) in 0 ms

org. 172800 IN NS a0.org.afilias-nst.info.
org. 172800 IN NS a2.org.afilias-nst.info.
org. 172800 IN NS b0.org.afilias-nst.org.
org. 172800 IN NS b2.org.afilias-nst.org.
org. 172800 IN NS c0.org.afilias-nst.info.
org. 172800 IN NS d0.org.afilias-nst.org.
org. 86400 IN DS 9795 7 1 364DFAB3DAF254CAB477B5675B10766DDAA24982
org. 86400 IN DS 9795 7 2 3922B31B6F3A4EA92B19EB7B52120F031FD8E05FF0B03BAFCF9F891B FE7FF8E5
org. 86400 IN RRSIG DS 8 1 86400 20170418170000 20170405160000 14796 . Eb/wzofvcNU8sz6xxpqLqyMdv+58y/UUjq/ZVRWhAqN0+meohGvBlDhA HCNC9KicGfczTrFoNj1AFvoLJIuE67xNXUZTO8ssGvJPntyIRbHX3woF BCu3i0jFnC3Q2UW/vd/7fLfZ/sAnkcgXTdJh9jn1mpci6aDjHT/W/rVt pqGsWtVHqgA1N8AjHxRJnPX4rAATttxt1X223b65r4+mQUPFl+c0HwCF GV0Uz3ua50GfllzwEkuRpbv8t61WqG2kx1Lo7BLWT/yUjO9KJGf5mlSA 3j1vSIpYwGVOqNhpGZAS45iYVKaffv1XgcPKA2ZYuFwGGluy2ISvOImB Jp8LyQ==
;; Received 820 bytes from 198.41.0.4#53(a.root-servers.net) in 96 ms

dev.org. 86400 IN NS ns3.inetu.net.
dev.org. 86400 IN NS ns4.inetu.net.
h9p7u7tr2u91d0v0ljs9l1gidnp90u3h.org. 86400 IN NSEC3 1 1 1 D399EAAB H9PARR669T6U8O1GSG9E1LMITK4DEM0T NS SOA RRSIG DNSKEY NSEC3PARAM
h9p7u7tr2u91d0v0ljs9l1gidnp90u3h.org. 86400 IN RRSIG NSEC3 7 2 86400 20170427021945 20170406011945 3947 org. FrNXTEayFVn78poCSGbfyOi9MIAj0CPr3mRz58NLo24A2bGTjGn2GUYn yeJ9KLIujGQ9n/GjDMUCVsGi8hiFVkaVSJxifQ+mRtAr17Tl2wI5oGOc XJhkyskdwwcbixUXW9YO4DhgoPB5TKT4W/VgDzIi6Rj9QequTSlmEnht bW4=
fimbh30fqc2qo2rluu55i3sugkfcf6en.org. 86400 IN NSEC3 1 1 1 D399EAAB FIN0LEVAV6LUVQ7R0OEP391NBOR6I8UG NS DS RRSIG
fimbh30fqc2qo2rluu55i3sugkfcf6en.org. 86400 IN RRSIG NSEC3 7 2 86400 20170422153137 20170401143137 3947 org. dwhDWzX3pFCgSiVA61c+axNQRPMVxGADutGTBPlpp1TeXJU+GaWePu9h SevV9uglfLHrnSpeolI9bR4KMnaFs27BFG+rAEmPiH/H+rStQGazMrKk crGHOuh5zzMneEr3w2/95mggJm2bC21lX9CfQsvYTl/gxYrdbdBI3VBw 73A=
;; Received 585 bytes from 199.249.120.1#53(b2.org.afilias-nst.org) in 88 ms

dev.org. 600 IN SOA ns3.inetu.net. dns.inetu.net. 2015020204 3600 300 86400 3600
;; Received 100 bytes from 74.85.141.3#53(ns3.inetu.net) in 84 ms

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

Спасибо вам большое за помощь. С клиентов и сервера нормально заходит. Все работает

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