Saturday, July 26, 2008

Configuration of bind, named, dns server

This is simple guide for configuration of bind, named, dns server and so...

Let's go to install named(bind) from your linux distribution...

There is one general configuration file:

---------------------------------

/etc/named.conf

options {
directory "/var/named";

};

# named.root is available at ftp://ftp.internic.net/domain/named.root

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

# Here is zone for domain ustrem.org

zone "ustrem.org" IN {
type master;
file "ustrem.org";
allow-transfer { none; };
allow-update { none; };

};

# Here is reverse zone zone for net 192.168.2.0/255.255.255.0

zone "2.168.192.in-addr.arpa" {
type master;
file "loc";
allow-update { none; };
};

----------------------------------------------------

Here is ustrem.org's zone file

-----------------------------

/var/named/ustrem.org

$ORIGIN .
$TTL 86400 ; 1 day
ustrem.org IN SOA pns.ustrem.org. onzi.ustrem.org. (

# onzi.ustrem.org is email for contacts (onzi_at_ustrem_dot_org)


2006083102 ; serial

# This is stamp for date and time and number of day change


3600 ; refresh (8 hours)
1800 ; retry (4 hours)
86400 ; expire (5 weeks 6 days 16 hours)
3600 ; minimum (1 day)
)
NS pns.ustrem.org.
NS ns1.xname.org.

# NS records for domain


A 213.240.243.12

# This line shows "ustrem.org" is with IP 213.240.243.12


MX 10 mail.ustrem.org.

# Here is SMTP server which received mails for ustrem.org


TXT "v=spf1 mx a:mail.b-trust.org a:mailrelay.bsbg.net -all"

# This is text record for prevent from spammers and spoofers. Here is SMTP-s which sends emails from ustrem.org

$ORIGIN ustrem.org.

* A 213.240.243.12

# some-does-not-described.ustrem.org is with IP 213.240.243.12


bobi A 213.240.227.125
pns A 213.240.243.12

*.bobi CNAME bobi.ustrem.org.

boiko A 84.238.128.65
george A 213.240.242.107


laptoper4e A 192.168.2.18
mitkosipc A 192.168.2.4
pi-server A 192.168.2.15
pz A 217.10.245.249
router A 192.168.2.24

----------------------------------------------------------------------------------

Here is reverse resolv

---------------------------------------------

/var/named/loc

$ORIGIN .
$TTL 86400 ; 1 day
2.168.192.in-addr.arpa IN SOA pns.ustrem.org. onzi.ustrem.org. (
2006080302 ; serial
28800 ; refresh (8 hours)
14400 ; retry (4 hours)
3600000 ; expire (5 weeks 6 days 16 hours)
86400 ; minimum (1 day)
)
NS pns.ustrem.org.
NS sns.ustrem.org.

$ORIGIN 2.168.192.in-addr.arpa.
4 PTR mitkosipc.ustrem.org.
18 PTR laptoper4e.ustrem.org.
15 PTR pi-server.ustrem.org.
24 PTR router.ustrem.org.

---------------------------------------------

This is enougt for BIND9 to work.

Now you can start and test it....

# dig ustrem.org @127.0.0.1

;; QUESTION SECTION:
;ustrem.org. IN A

;; ANSWER SECTION:
ustrem.org. 86400 IN A 213.240.243.12

# dig ustrem.org @127.0.0.1 MX

;; QUESTION SECTION:
;ustrem.org. IN MX

;; ANSWER SECTION:
ustrem.org. 86400 IN MX 10 mail.ustrem.org.

# dig -x 192.168.2.4 @127.0.0.1

;; QUESTION SECTION:
;4.2.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
4.2.168.192.in-addr.arpa. 86400 IN PTR mitkosipc.ustrem.org.

That is all ;)

No comments: