Здесь я опишу настройку штатного сервера имен во FreeBSD — named

Имеем следущее
deathstar# cd /etc/namedb/ && ls
dynamic master named.conf named.root rndc.key slave working
deathstar#

Мне нужно было поддержку 2-ух зон.После чего конфиг выглядил вот так


// $FreeBSD$
//
// If you are going to set up an authoritative server, make sure you
// understand the hairy details of how DNS works. Even with
// simple mistakes, you can break connectivity for affected parties,
// or cause huge amounts of useless Internet traffic.

options {
directory "/etc/namedb";
pid-file "/var/run/named/pid";
dump-file "/var/dump/named_dump.db";
statistics-file "/var/stats/named.stats";

// If named is being used only as a local resolver, this is a safe default.
// For named to be accessible to the network, comment this option, specify
// the proper IP address, or delete this option.
listen-on { 127.0.0.1; 192.168.0.198; 10.0.64.41; 46.47.18.39; };

// If you have IPv6 enabled on this system, uncomment this option for
// use as a local resolver. To give access to the network, specify
// an IPv6 address, or the keyword "any".
// listen-on-v6 { ::1; };

// In addition to the "forwarders" clause, you can force your name
// server to never initiate queries of its own, but always ask its
// forwarders only, by enabling the following line:
//
// forward only;

// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below. This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.

forwarders {
8.8.8.8; 10.0.0.2; 10.0.0.3; 8.8.4.4 ; 93.127.19.150;
};

/*
* If there is a firewall between you and name servers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};

// If you enable a local name server, don't forget to enter 127.0.0.1
// first in your /etc/resolv.conf so this server will be queried.
// Also, make sure to enable it in /etc/rc.conf.
// RFC 3152

// NB: Do not use the IP addresses below, they are faked, and only
// serve demonstration/documentation purposes!
//
// Example slave zone config entries. It can be convenient to become
// a slave at least for the zone your own domain is in. Ask
// your network administrator for the IP address of the responsible
// primary.
//
// Never forget to include the reverse lookup (IN-ADDR.ARPA) zone!
// (This is named after the first bytes of the IP address, in reverse
// order, with ".IN-ADDR.ARPA" appended.)
//
// Before starting to set up a primary zone, make sure you fully
// understand how DNS and BIND works. There are sometimes
// non-obvious pitfalls. Setting up a slave zone is simpler.
//
// NB: Don't blindly enable the examples below. :-) Use actual names
// and addresses instead.

/* An example master zone
zone "example.net" {
type master;
file "master/example.net";
};
*/

zone "deathstar.name" {
type master;
file "/etc/namedb/master/deathstar.name";
allow-transfer { 78.31.177.158; 195.24.128.164; };
allow-query { any; };
notify yes;
};

zone "shipa.net.ru" {
type master;
file "/etc/namedb/master/shipa.net.ru";
allow-transfer { 78.31.177.158; 195.24.128.164; };
allow-query { any; };
notify yes;
};

Опишу зону построчно
Имя зоны
zone «deathstar.name» {
Тип зоны
type master;
Файл зоны
file «/etc/namedb/master/deathstar.name»;
Разрешаем импорт зоны (в моем случае 2 сервера,один бесплатный второй друга,так как держать 2 NS сервера нет возможности,а вторичный сервер нужен
allow-transfer { 78.31.177.158; 195.24.128.164; };
Разрешаем обращение к серверу с любых хостов
allow-query { any; };
Сообщаем вторичным серверам об изменениях в зоне
notify yes;
};

Файл зоны deathstar.name выглядит так


$TTL 3600
deathstar.name. IN SOA ns1.deathstar.name. deathstar.deathstar.name. (2010112101 7200 3600 259200 86400)
deathstar.name. IN NS ns2.trifle.net.
deathstar.name. IN NS ns1.hartois.info.
deathstar.name. IN NS ns1.deathstar.name.
deathstar.name. IN MX 10 mail
deathstar.name. IN MX 20 mx
deathstar.name. IN A 46.47.18.39
ns1 IN A 46.47.18.39
www IN A 46.47.18.39
ftp IN A 46.47.18.39
mx IN A 46.47.18.39
mail IN A 46.47.18.39
smtp IN A 46.47.18.39
pop IN A 46.47.18.39
icq IN A 46.47.18.39
mrim IN A 46.47.18.39
_jabber._tcp.deathstar.name. 86400 IN SRV 5 0 5269 46.47.18.39.
_xmpp-server._tcp.deathstar.name. 86400 IN SRV 5 0 5269 46.47.18.39.
_xmpp-client._tcp.deathstar.name. 86400 IN SRV 5 0 5222 46.47.18.39.

Опять же распишу построчно

$TTL 3600
Здесь прописываем домен и сервер имен и email администратора,через точку,а не собаку.
2010112101 — по этой записи вторичные сервера отслеживают изменения,обычно пишутся в пормате ГГГГММДД и два любых числа от 00 до 99,при каждом изменении число должно быть увеличено
deathstar.name. IN SOA ns1.deathstar.name. deathstar.deathstar.name. (2010112101 7200 3600 259200 86400)
Собственно здесь прописываем сервера имен,на которых висит зона,в моем случае их три,мой,тот что настроил,бесплатный,и друга
deathstar.name. IN NS ns2.trifle.net.
deathstar.name. IN NS ns1.hartois.info.
deathstar.name. IN NS ns1.deathstar.name.
Здесь описываем MX записи для почтового сервера
deathstar.name. IN MX 10 mail
deathstar.name. IN MX 20 mx
Здесь описываем поддомены ( 46.47.18.39 — это IP машины,на который будет направляться запрос)
deathstar.name. IN A 46.47.18.39
ns1 IN A 46.47.18.39
www IN A 46.47.18.39
ftp IN A 46.47.18.39
mx IN A 46.47.18.39
mail IN A 46.47.18.39
smtp IN A 46.47.18.39
pop IN A 46.47.18.39
icq IN A 46.47.18.39
mrim IN A 46.47.18.39
Здесь SRV запси для Jabber сервера =)
_jabber._tcp.deathstar.name. 86400 IN SRV 5 0 5269 46.47.18.39.
_xmpp-server._tcp.deathstar.name. 86400 IN SRV 5 0 5269 46.47.18.39.

_xmpp-client._tcp.deathstar.name. 86400 IN SRV 5 0 5222 46.47.18.39.

Добавляем в /etc/rc.conf
named_enable="YES"
и стартуем
/etc/rc.d/named start