github.com/philhug/dnscontrol@v0.2.4-0.20180625181521-921fa9849001/docs/_functions/global/REV.md (about) 1 --- 2 name: REV 3 parameters: 4 - address 5 --- 6 7 `REV` returns the reverse lookup domain for an IP network. For 8 example `REV('1.2.3.0/24')` returns `3.2.1.in-addr.arpa.` and 9 `REV('2001:db8:302::/48)` returns `2.0.3.0.8.b.d.0.1.0.0.2.ip6.arpa.`. 10 This is used in `D()` functions to create reverse DNS lookup zones. 11 12 This is a convenience function. You could specify `D('3.2.1.in-addr.arpa`, 13 ...` if you like to do things manually but why would you risk making 14 typos? 15 16 `REV` complies with RFC2317, "Classless in-addr.arpa delegation" 17 for netmasks of size /25 through /31. 18 While the RFC permits any format, we abide by the recommended format: 19 `FIRST/MASK.C.B.A.in-addr.arpa` where `FIRST` is the first IP address 20 of the zone, `MASK` is the netmask of the zone (25-31 inclusive), 21 and A, B, C are the first 3 octets of the IP address. For example 22 `172.20.18.130/27` is located in a zone named 23 `128/27.18.20.172.in-addr.arpa` 24 25 If the address does not include a "/" then `REV` assumes /32 for IPv4 addresses 26 and /128 for IPv6 addresses. 27 28 Note that the lower bits (the ones outside the netmask) must be zeros. They are not 29 zeroed out automatically. Thus, `REV('1.2.3.4/24') is an error. This is done 30 to catch typos. 31 32 {% include startExample.html %} 33 {% highlight js %} 34 D(REV('1.2.3.0/24'), REGISTRAR, DnsProvider(BIND), 35 PTR("1", 'foo.example.com.'), 36 PTR("2", 'bar.example.com.'), 37 PTR("3", 'baz.example.com.'), 38 // These take advantage of DNSControl's ability to generate the right name: 39 PTR("1.2.3.10", 'ten.example.com.'), 40 ); 41 42 D(REV('2001:db8:302::/48'), REGISTRAR, DnsProvider(BIND), 43 PTR("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0", 'foo.example.com.'), // 2001:db8:302::1 44 // These take advantage of DNSControl's ability to generate the right name: 45 PTR("2001:db8:302::2", 'two.example.com.'), // 2.0.0... 46 PTR("2001:db8:302::3", 'three.example.com.'), // 3.0.0... 47 ); 48 49 50 {%endhighlight%} 51 {% include endExample.html %} 52 53 In the future we plan on adding a flag to `A()` which will insert 54 the correct PTR() record if the approprate `D(REV()` domain (i.e. `.arpa` domain) has been 55 defined.