DNS is also used to look up hostnames by IP address.

Now read RFC 2317 about classless in-addr.arpa delegation.

No. It must be ip chunks. It breaks through the classful ip blocks, but still need the addresses to be continuous.

In the RFC we can see that the solution accepts syntax like classless ip blocks.

$ORIGIN 2.0.192.in-addr.arpa.
   @       IN      SOA     my-ns.my.domain. hostmaster.my.domain. (...)
   ;...
   ;  <<0-127>> /25
   0/25            NS      ns.A.domain.
   0/25            NS      some.other.name.server.
   ;
   1               CNAME   1.0/25.2.0.192.in-addr.arpa.
   2               CNAME   2.0/25.2.0.192.in-addr.arpa.
   3               CNAME   3.0/25.2.0.192.in-addr.arpa.

It is not bounded with oct ip blocks. But still need the blocks to be continuous. For seperate ip addresses, for example. 123.123.123.123 and 123.123.200.200, it is not possible to efficiently put them into one block. We can use route summary to make it 123.123.0.0/16, but this is not practically possible since there are too many IPs in-between which belong to other organizations.

I setup my revers zone in the same way I setup the forward zone.
Firstly, edit the named.conf

nano /etc/named.conf
 
// reverse for my zone
zone "80/28.106.100.145.in-addr.arpa" in {
  type master;
  notify no;
  file "80.106.100.145.in-addr.arpa.db";
};

The 80/28.106.100.145 is my assignment ip chunk 145.100.106.80.28 in the reversed classless order.

Then create and edit the zone file for it

touch 80.106.100.145.in-addr.arpa.db
 
$TTL 1h
$ORIGIN 80/28.106.100.145.in-addr.arpa.
@       IN      SOA    rome.studlab.os3.nl. hostmaster.rome.studlab.os3.nl.    $
20100921  ;serial
10h; refresh
5h; retry
1d; expire
2h; min
)
 
@ in                   NS      rome.studlab.os3.nl.
;
 
81    in                PTR     webservice.rome.practicum.os3.nl.
82    in                PTR     ns.rome.practicum.os3.nl.
83    in                PTR     mail.rome.practicum.os3.nl.
84    in                PTR     idea.rome.practicum.os3.nl.

My machine name is required.

Delegating your own zone

Since I am delegating the zone, I do not have control over it afterward, I do not have to create a zone file for that. But I will act as a slave for that zone, and receive zone file tranfer. I have to edit the rome.practicum.os3.nl zone file to reflect the fact that I've delegated the sub-domain to other people

; sub-domain definitions
$ORIGIN pizza.rome.practicum.os3.nl.
 
; we define two name servers for the sub-domain
@             IN      NS     rome.studlab.os3.nl.
@              IN      NS     ns1.luxembourg.practicum.os3.nl. ;partner's dns
ns1.luxembourg.practicum.os3.nl in A 145.100.104.50 ; glue

Setting up a slave server

here is the named.conf. My server act as the slave.

// slave for subdomain pizza.rome.practicum.os3.nl
zone "pizza.rome.practicum.os3.nl" {
  type slave;
  file "slave.pizza.rome.practicum.os3.nl";
  masters {145.100.104.50;};
};

The slave server will use the cached result before the expiration.

Zone transfers

use dig to do the zone transfer

root@rome:/etc/named# dig @ns1.luxembourg.practicum.os3.nl pizza.rome.practicum.os3.nl axfr
 
; <<>> DiG 9.7.2 <<>> @ns1.luxembourg.practicum.os3.nl pizza.rome.practicum.os3.nl axfr
; (1 server found)
;; global options: +cmd
; Transfer failed.

The slave server, in this case my server, will ask the specific NS server (master) for the specified zone (request target).

  1. My server (slave) will check the SOA and try to find out if the serials number is updated.
  2. if serials number is updated, then slave will send out the request for zone transfer. if not, the zone transfer will not happen.
  3. Slave receives the whole zone file, the same as the one on the master.

The zone transfer is a big chunk of data compare to normal DNS packet. It should not happen too often to avoid extra burden.

acl "allowedip" {
  ip address of the lab;
}; 

allow-transfer {allowedip};
allow-recursion {allowedip};

Now only machine with IP address of the allowed ip, so lab machines, can ask the server to do recursion and transfer for it.

Extra Assignments

server