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

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


bind:bind

Это старая версия документа!


Сервер BIND

BIND (Berkeley Internet Name Domain, до этого: Berkeley Internet Name Daemon) — открытая и наиболее распространённая реализация DNS сервера.

https://www.isc.org/downloads/bind/

Все примеры для BIND 9

Установка

apt-get install bind9

Создаем файл протокола

touch /var/log/named.log
chown bind /var/log/named.log

Настройка

Основная папка/etc/bind
Папка для размещения slave зон/var/cache/bind

Обычный сервер (slave)

named.conf.local

named.conf.local
include "/etc/bind/zones.rfc1918";
zone "domain.ru" in {
        type slave;
        file "db.domain.ru.slave";
        masters { 192.168.1.1; };
        };
 
zone "1.168.192.in-addr.arpa" in {
        type slave;
        file "db.1.168.192.in-addr.arpa.slave";
        masters { 192.168.1.1; };
        };

В этом примере описана прямая и обратная зона.

named.conf.options

named.conf.options
options {
        directory "/var/cache/bind";
        auth-nxdomain no;
        listen-on-v6 { any; };
        listen-on { any; };
        forwarders { 127.0.0.1 port 5353; 8.8.8.8;};
};
 
logging {
	channel  namedlog {
		file "/var/log/named.log";
		severity warning;
		print-time yes;
		print-severity yes;
		print-category yes;
	};
	category default { namedlog; };
	category security { namedlog; };
};

Все запросы, которые не смог разрешить это сервер будут оправлены на 192.168.1.1

Главный сервер (master)

named.conf.local

named.conf.local
include "/etc/bind/zones.rfc1918";
 
zone "domain.ru" in {
	type master;
	file "/etc/bind/db.domain.ru";
	allow-update { none; };
	allow-transfer { 192.168.1.2; 192.168.1.3;};
	};
 
zone "1.168.192.in-addr.arpa" in {
	type master;
	file "/etc/bind/db.1.168.192";
	allow-update { none; };
	allow-transfer { 192.168.1.2; 192.168.1.3;};
	};

named.conf.options

named.conf.options
options {
	directory "/var/cache/bind";
	auth-nxdomain no;
	listen-on-v6 { any; };
	listen-on { any; };
        forwarders { 127.0.0.1 port 5353; 8.8.8.8;};
	allow-recursion { 127.0.0.1; 192.168.1.2; 192.168.1.3;};
 
};
 
logging {
	channel  namedlog {
		file "/var/log/named.log";
		severity warning;
		print-time yes;
		print-severity yes;
		print-category yes;
	};
	category default { namedlog; };
	category security { namedlog; };
};

Прямая зана

db.domain.ru
$ORIGIN .
$TTL 178600	; 2 days 1 hour 36 minutes 40 seconds
domain.ru	IN SOA  ns.domain.ru. root.domain.ru. (
				1		; serial
				28800		; refresh (8 hours)
				7200		; retry (2 hours)
				1209600		; expire (2 weeks)
				7200		; minimum (2 hours)
				)
			NS	ns.domain.ru.
			NS	ns2.domain.ru.
			NS	ns3.domain.ru.
			MX	10 mail.domain.ru.
$ORIGIN domain.ru.
localhost		A	127.0.0.1
ns			A	192.168.1.1
ns2			A	192.168.1.2
ns3			A	192.168.1.3
mail			A	192.168.1.4
ldap                    A       192.168.1.2
ldap                    A       192.168.1.3
webmail			CNAME	mail
smtp			CNAME	mail
imap			CNAME	mail
gate			CNAME	ns

Обратная зона

db.1.168.192
$ORIGIN .
$TTL 178600     ; 2 days 1 hour 36 minutes 40 seconds
1.168.192.in-addr.arpa	IN SOA  ns.domain.ru. root.domain.ru. (
				1		; serial
				28800		; refresh (8 hours)
				7200		; retry (2 hours)
				1209600		; expire (2 weeks)
				7200		; minimum (2 hours)
				)
			NS	ns.domain.ru.
$ORIGIN 1.168.192.in-addr.arpa.
1			PTR	ns.domain.ru.
2			PTR	ns2.domain.ru.
3			PTR	ns3.domain.ru.
4			PTR	mail.domain.ru.

Ссылки

bind/bind.1493819453.txt.gz · Последние изменения: 2019-03-29 10:28 (внешнее изменение)