Link to home
Start Free TrialLog in
Avatar of ricuff
ricuffFlag for Italy

asked on

Reverse DNS Bind

hi experts, I need help setting a reverse dns for a domain. I created the zone file

$ttl 38400
domain.tld.      IN      SOA      ns1.domain.tld. web.domain.tld. (
                  1217619153
                  10800
                  3600
                  604800
                  38400 )
domain.tld.      IN      NS      ns1.domain.tld.
domain.tld.      IN      A      192.168.1.1
domain.tld.      IN      NS      ns2.domain.tld.
ns1.domain.tld.      IN      A      192.168.1.1
ns2.domain.tld.      IN      A      192.168.1.2
www.domain.tld.      IN      CNAME      domain.tld.

I updated named.conf

zone "domain.tld" {
      type master;
      file "/var/named/chroot/var/named/domain.tld.hosts";
      };

and now the DNS is working fine, but I want to create a reverse zone PTR but I have no clue on how to do it, could you give me a step by step example to configure it??

thanks
Avatar of Raheem05
Raheem05
Flag of United Kingdom of Great Britain and Northern Ireland image

Avatar of ricuff

ASKER

could you give me a step by step help configuring it thanks
OK do you host your own DNS? I am assuming you do by the IP address please clarify
Avatar of ricuff

ASKER

yes I host my dns and I have static ip address thanks
Is this a windows DNS on a windows box?
Avatar of ricuff

ASKER

linux on centos and bind
Avatar of Kerem ERSOY
Kerem ERSOY

Hi Please modify your zone file such as below:

@ macro reresents the zonne neame you've defined in your named.conf to refer this zone. So you don't need to explicitly specify the name jsut to mention @ is enough. Then you don't need to specify the domain name explicitly if it will refer the prevous record. soI've deleted them. Another point is you don't need to enter FQDN if all server names are relative to your own domain. since it will be completed with the domain itself. I've removed them too and for convenience I've put NS records together and then the A record.

Please check these RFC's for DNS zones:

RFC1912
RFC2181
RFC2182
RFC2308
$ttl 7200     ; RFC 2308 staes 1-3 hours
@         IN      SOA      ns1.domain.tld. web.domain.tld. (
                  2010011301   ; According to RFC 1912 YYYYMMDDnn
                  10800        ; RFC 1912 1200 - 43200 Seconds OK
                  3600         ; RFC 1912 120-7200 seconds OK
                  604800       ; RFC 1912 2-4W  should be at least: 1209600 Please modify
                  38400 )      ; RFC 2038 1-3 hours Please modify

                 IN      NS      ns1
                 IN      NS      ns2
                 IN      A       192.168.1.1
ns1              IN      A      192.168.1.1
ns2              IN      A      192.168.1.2
www              IN      CNAME      ns1

Open in new window

Your path is an absolute path. You won't be seeing the whole tree after you've chrooted. Don't you use the chrooted version of named? This is too dangerous !!! if your're not using it just install the fileset:

yum install named-chroot.

to check what version of named you're using use the command:

rpm -qa | grep bind


Cheers,
K.
This is what your named.conf should look like:
acl localnet { x.x.x.x/y; }

options {
        version "12.2.5I";
        directory "/var/named";
        dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";

        allow-transfer { localnet;};

        allow-recursion { localnet; };
};

zone "." in {
        type hint;
        file "data/named.root";
};

// Assumeng your IP segment is 10.20.30.x and whole C class belongs to you

zone "30.20.10.in-addr.arpa" in {
        type master;
        file "data/named.loc";
};

zone "domain.tld" {
      type master;
      file "data/domain.tld.hosts";
};


zone "0.0.127.in-addr.arpa" in {
        type master;
        file "data/named.loc";
};

Open in new window

Avatar of ricuff

ASKER

ok now should I save this as zone file? if yes should I save it in rhe normal zone file? and where I see the PTR record?
OOps sorry this should read:
zone "30.20.10.in-addr.arpa" in {
        type master;
        file "data/named.rev-10.20.30";
};

Open in new window

The contents should be something similar to the below snippet. Notice that this time DNS servers are FQDN. SOA values are in accordance with related RFC's

and don't for get that:
-  The first parameter in SOA must be one of your name servers since it is your domain origin.
- The second parameter is the address only the first dot will be replaced with a "@" so your address in the below code will be interpreted as :

postmaster.domain.tld    postmaster@domain.tld

I don't know if you really have an email address like web@domain.tld (according to your SOA record)  in your SMTP server if not replace it to something valid. Please check the RFC 1912.

Cheers,
K.
$ttl 7200     
@         IN      SOA      ns1.domain.tld. postmaster.domain.tld. (
                  2010011301   ; Serial
                  10800        ; Refresh for secondaries
                  3600         ; Retry
                  1209600      ; Expire
                  7200 )       ; TTL

                 IN      NS      ns1.domain.tld.
                 IN      NS      ns2.domain.tld.

1                IN      PTR     ns1.domain.tld.
2                IN      PTR     ns2.domain.tld.

Open in new window

> ok now should I save this as zone file? if yes should I save it in rhe normal zone file? and where I see
> the PTR record?

The example in the note <a href=https://www.experts-exchange.com/questions/25050670/Reverse-DNS-Bind.html?anchorAnswerId=26302064#a26302064>http://#26302064</a> is the contents of your /var/named/chroot/etc/named.conf not a zone file.

cheers,
K.
The zone file belongs to the address range:

10.20.30   = 30.20.10.in-addr.arpa

The record "1 PTR  ..." hence means : 10.20.30.1

I've used the 10.x.x.x segment for convenience. In your IP range it would be: 192.168.1.1 and the zone record in your named.conf will be:

zone "1.168.192.in-addr.arpa" in {
        type master;
        file "data/named.rev-192.168.1";
};


so the @ macro for this zoe will mean: 1.168.192.in-addr.arpa This is why we're using absolute path for the DNS servers otherwise we just leave them as ns1 and ns2 they will be completed as :

ns1.1.192.168.in-addr.arpa which would be meaningless.

Cheers,
K.
Avatar of ricuff

ASKER

ok let me understand please

1) I modify the existing zone file and I add the @         IN      SOA      ns1.domain.tld. web.domain.tld.
instead of domain.tld.      IN      SOA      ns1.domain.tld. web.domain.tld. and save it

2) I add to named.conf
zone "30.20.10.in-addr.arpa" in {
        type master;
        file "data/named.rev-10.20.30";
};

3) I create a file with this content
$ttl 7200      
@         IN      SOA      ns1.domain.tld. postmaster.domain.tld. (
                  2010011301   ; Serial
                  10800        ; Refresh for secondaries
                  3600         ; Retry
                  1209600      ; Expire
                  7200 )       ; TTL
 
                 IN      NS      ns1.domain.tld.
                 IN      NS      ns2.domain.tld.
 
1                IN      PTR     ns1.domain.tld.
2                IN      PTR     ns2.domain.tld.


and where I should save it and what name?
ASKER CERTIFIED SOLUTION
Avatar of Kerem ERSOY
Kerem ERSOY

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ricuff

ASKER

ok thanls I am going to try it please give me a few hours to finish and let you know thanks
ok just take your time and let me know If I could be of further help.

cheers,
k.
Avatar of ricuff

ASKER

thanks great it is working
You're welcome.