Общие сведения по настройке DNS сервера
Статья включает:
Создайте директорию для конфигурационных файлов DNS-сервера, например /home/test-named
. Поместите в неё файл конфигурации named.conf, файлы зон root.hint и example.com. Примеры файлов приведены ниже:
Файл named.conf
options { query-source address 192.168.1.1; notify-source 192.168.1.1; transfer-source 192.168.1.1; port 16303; pid-file "named.pid"; listen-on { 192.168.1.1; }; listen-on-v6 { none; }; recursion yes; allow-recursion { any; }; notify yes; ixfr-from-differences yes; check-integrity no; dnssec-validation no; allow-query { any; }; }; zone "." { type hint; file "/home/test-named/root.hint"; }; zone "example" { type primary; file "/home/test-named/example.com"; };
Файл root.hint
$TTL 999999 . IN NS a.root-servers.nil. a.root-servers.nil. IN A 192.168.1.1
Файл example.com
; base zone file for example.com $TTL 2d ; default TTL for zone $ORIGIN example.com. ; base domain-name ; Start of Authority RR defining the key characteristics of the zone (domain) @ IN SOA ns1.example.com. hostmaster.example.com. ( 2003080800 ; serial number 12h ; refresh 15m ; update retry 3w ; expiry 2h ; minimum ) ; name server RR for the domain IN NS ns1.example.com. ; the second name server is external to this zone (domain) IN NS ns2.example.net. ; mail server RRs for the zone (domain) 3w IN MX 10 mail.example.com. ; the second mail servers is external to the zone (domain) IN MX 20 mail.example.net. ; domain hosts includes NS and MX records defined above ; plus any others required ; for instance a user query for the A RR of joe.example.com will ; return the IPv4 address 192.168.254.6 from this zone file ns1 IN A 192.168.254.2 mail IN A 192.168.254.4 joe IN A 192.168.254.6 www IN A 192.168.254.7 ; aliases ftp (ftp server) to an external domain ftp IN CNAME ftp.example.net.
Проверьте named.conf с помощью утилиты named-checkconf:
# named-checkconf named.conf
Запустите сервер named:
# named -c named.conf -d10 -L named.log
Проверьте корректность запуска named в файле журналирования named.log.
Отправьте запрос DNS-серверу с помощью утилиты dig:
# dig @192.168.1.1 -p 16303 ns1.example.com
При корректной работе DNS-сервера ответ должен включать в себя строку "1 server found".
Предыдущий раздел: перейти