summaryrefslogtreecommitdiffstats
path: root/src/knot/modules/synthrecord/synthrecord.rst
blob: 4ad0a4b1348e76d3a804ab9f2d0d566d9acf3283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
.. _mod-synthrecord:

``synthrecord`` – Automatic forward/reverse records
===================================================

This module is able to synthesize either forward or reverse records for
a given prefix and subnet.

Records are synthesized only if the query can't be satisfied from the zone.
Both IPv4 and IPv6 are supported.

Example
-------

Automatic forward records
.........................

::

   mod-synthrecord:
     - id: test1
       type: forward
       prefix: dynamic-
       ttl: 400
       network: 2620:0:b61::/52

   zone:
     - domain: test.
       file: test.zone # Must exist
       module: mod-synthrecord/test1

Result:

.. code-block:: console

   $ kdig AAAA dynamic-2620-0-b61-100--1.test.
   ...
   ;; QUESTION SECTION:
   ;; dynamic-2620-0-b61-100--1.test. IN AAAA

   ;; ANSWER SECTION:
   dynamic-2620-0-b61-100--1.test. 400 IN AAAA 2620:0:b61:100::1

You can also have CNAME aliases to the dynamic records, which are going to be
further resolved:

.. code-block:: console

   $ kdig AAAA alias.test.
   ...
   ;; QUESTION SECTION:
   ;; alias.test. IN AAAA

   ;; ANSWER SECTION:
   alias.test. 3600 IN CNAME dynamic-2620-0-b61-100--2.test.
   dynamic-2620-0-b61-100--2.test. 400 IN AAAA 2620:0:b61:100::2

Automatic reverse records
.........................

::

   mod-synthrecord:
     - id: test2
       type: reverse
       prefix: dynamic-
       origin: test
       ttl: 400
       network: 2620:0:b61::/52

   zone:
     - domain: 1.6.b.0.0.0.0.0.0.2.6.2.ip6.arpa.
       file: 1.6.b.0.0.0.0.0.0.2.6.2.ip6.arpa.zone # Must exist
       module: mod-synthrecord/test2

Result:

.. code-block:: console

   $ kdig -x 2620:0:b61::1
   ...
   ;; QUESTION SECTION:
   ;; 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.6.b.0.0.0.0.0.0.2.6.2.ip6.arpa. IN PTR

   ;; ANSWER SECTION:
   1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.6.b.0.0.0.0.0.0.2.6.2.ip6.arpa. 400 IN PTR dynamic-2620-0-b61--1.test.

Module reference
----------------

::

 mod-synthrecord:
   - id: STR
     type: forward | reverse
     prefix: STR
     origin: DNAME
     ttl: INT
     network: ADDR[/INT] | ADDR-ADDR ...
     reverse-short: BOOL

.. _mod-synthrecord_id:

id
..

A module identifier.

.. _mod-synthrecord_type:

type
....

The type of generated records.

Possible values:

- ``forward`` – Forward records
- ``reverse`` – Reverse records

*Required*

.. _mod-synthrecord_prefix:

prefix
......

A record owner prefix.

.. NOTE::
   The value doesn’t allow dots, address parts in the synthetic names are
   separated with a dash.

*Default:* empty

.. _mod-synthrecord_origin:

origin
......

A zone origin (only valid for the :ref:`reverse type<mod-synthrecord_type>`).

*Required*

.. _mod-synthrecord_ttl:

ttl
...

Time to live of the generated records.

*Default:* ``3600``

.. _mod-synthrecord_network:

network
.......

An IP address, a network subnet, or a network range the query must match.

*Required*

.. _mod-synthrecord_reverse-short:

reverse-short
.............

If enabled, a shortened IPv6 address can be used for reverse record rdata synthesis.

*Default:* ``on``