#### Current Setup
Right now the sre.dns.netbox cookbook generates numerous different files which ultimate go into ///etc/gdnsd/zones/netbox/// on auth dns servers. Each of these needs to have an INCLUDE statement pointing to it in the static zone files we create in the [[ https://gerrit.wikimedia.org/r/admin/repos/operations/dns | dns repo. ]] This is extremely cumbersome, tedious and error-prone, especially for IPv6 reverses where we have a separate file for every single link on the Network (as each have their own /64 subnet).
Right now, for instance, our zone files have entries like this:
```
cmooney@dns3003:/etc/gdnsd/zones$ tail -7 0.8.c.e.2.0.a.2.ip6.arpa
; cr2-magru <-> asw1-b4-magru (2a02:ec80:700:fe09::/64)
$ORIGIN 9.0.e.f.0.0.7.0.@Z
$INCLUDE netbox/9.0.e.f.0.0.7.0.0.8.c.e.2.0.a.2.ip6.arpa
; Magru network loopbacks (2a02:ec80:700:ffff::/64)
$ORIGIN f.f.f.f.0.0.7.0.@Z
$INCLUDE netbox/f.f.f.f.0.0.7.0.0.8.c.e.2.0.a.2.ip6.arpa
```
The contents of each of the included files, generated by Netbox, only have the PTR (or A / AAAA) records that go under that $ORIGIN:
```
cmooney@dns3003:/etc/gdnsd/zones$ cat ./netbox/9.0.e.f.0.0.7.0.0.8.c.e.2.0.a.2.ip6.arpa
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 1H IN PTR et-0-0-2.cr2-magru.wikimedia.org.
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 1H IN PTR et-0-0-50.asw1-b4-magru.wikimedia.org.
```
```
cmooney@dns3003:/etc/gdnsd/zones$ cat ./netbox/f.f.f.f.0.0.7.0.0.8.c.e.2.0.a.2.ip6.arpa
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 1H IN PTR cr1-magru.wikimedia.org.
```
#### Alternate Approach
What I would propose is we change how we do things as follows:
* For each zone file we are authoritative for we should have a single INCLUDE statement for netbox entries
* The INCLUDE should be at the zone 'apex' (i.e. `$ORIGIN @Z`)
* The single file it points to should have all the records from Netbox that are in that zone
* We just place DNS records in the snippets - with full label relative to the parent zone - instead of also using $ORIGIN statements
**/etc/gdnsd/zones/0.8.c.e.2.0.a.2.ip6.arpa:**
```
@ 1H IN SOA ns0.wikimedia.org. hostmaster.wikimedia.org. 2024041716 12H 2H 2W 1H
@ 1D IN NS ns0.wikimedia.org.
@ 1D IN NS ns1.wikimedia.org.
@ 1D IN NS ns2.wikimedia.org.
; Netbox generated entries
$INCLUDE netbox/0.8.c.e.2.0.a.2.ip6.arpa @Z
; Static entries
$ORIGIN x xx x x
yyy IN PTR blah.wikimedia.org.
```
**/etc/gdnsd/zones/netbox/0.8.c.e.2.0.a.2.ip6.arpa:**
```
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.e.f.0.0.7.0 IN PTR et-0-0-2.cr2-magru.wikimedia.org.
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.0.e.f.0.0.7.0 IN PTR et-0-0-50.asw1-b4-magru.wikimedia.org.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.f.f.f.f.0.0.7.0 IN PTR cr1-magru.wikimedia.org.
```