DNS - make it sample and fast, part 3

8. Master domain zone
I will create sample record for my master zone in file master.example.net
[root@nsd named]# cat master.example.net
@ IN SOA nsd.example.net. root@nsd.example.net. (
        2010072401 ; serial
        3600 ; refresh
        900 ; retry
        1209600 ; expire
        43200 ; default_ttl
)
@       IN NS   nsd.example.net.
@       IN MX 1 centos.example.net.

gw1        IN A    10.1.0.1
gw2         IN A    10.1.0.2
nsd         IN A    10.1.0.5
centos      IN A    10.1.0.10

As you can see I define one nameserver, one mail exchanger and four hosts
9. Reverse zone for network 10.1.0
@ IN SOA nsd.example.net. root@nsd.example.net. (
        2010072401 ; serial
        3600 ; refresh
        900 ; retry
        1209600 ; expire
        43200 ; default_ttl
)
@       IN NS   nsd.example.net

1       IN PTR gw1.example.net.
2       IN PTR gw1.example.net.
5       IN PTR nsd.example.net.
10      IN PTR centos.example.net.


I have only four IP addresses. Do not forget the dot on the end of host names
10. Check the configuration
[root@nsd named]# service named configtest
master.example.net:1: no TTL specified; using SOA MINTTL instead
zone example.net/IN: loaded serial 2010072401
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
10.1.0.rev:1: no TTL specified; using SOA MINTTL instead
zone 0.1.10.IN-ADDR.ARPA/IN: loaded serial 2010072401


All seems OK, so its time to start the service and make some tests
11. Start and tests
[root@nsd named]# service named restart
Starting named:                                            [  OK  ]
[root@nsd named]# nslookup gw1
Server:         10.1.0.5
Address:        10.1.0.5#53

Name:   gw1.example.net
Address: 10.1.0.1

[root@nsd named]# nslookup gw1.example.net
Server:         10.1.0.5
Address:        10.1.0.5#53

Name:   gw1.example.net
Address: 10.1.0.1

[root@nsd named]# nslookup 10.1.0.5
Server:         10.1.0.5
Address:        10.1.0.5#53

5.0.1.10.in-addr.arpa   name = nsd.example.net.
[root@nsd named]# nslookup
> set q=ns
> example.net
Server:         10.1.0.5
Address:        10.1.0.5#53

example.net     nameserver = nsd.example.net.
> set q=mx
> example.net
Server:         10.1.0.5
Address:        10.1.0.5#53

example.net     mail exchanger = 1 centos.example.net.
> exit

At the end our nameserver is up and running and can server my domain and my IP range for my home network. For further information about parameters you see in usage in above files please refer official Bind documentation

No comments:

Post a Comment

Compressed tar archive

There are some cases when you want to create compressed tar archive but you do not have enough disk space to keep original files and tar arc...