CZ-NIC / knot-resolver

Knot Resolver - resolve DNS names like it's 2024
https://www.knot-resolver.cz/
Other
364 stars 59 forks source link

Reading the DNS root zone file will result in invalid syntax #47

Closed kometchtech closed 7 years ago

kometchtech commented 7 years ago

When obtaining the DNS root zone file as below and loading with knot-resolver, the following error is output.

  1. Obtain the DNS root zone file $ dig @e.root-servers.net . ns | sudo tee /etc/knot-resolver/named.root

  2. Execute with the following parameters $ sudo -u knot-resolver kresd -c /etc/knot-resolver/kresd.conf -v -f 1 -k /etc/knot-resolver/root.key

  3. An error message is output

    [system] bind to 'fe80::21e:6ff:fe33:8502@9953' Invalid argument
    [     ][hint] /etc/knot-resolver/named.root:2: invalid syntax
    [ ta ] warning: overriding previously set trust anchors for .

In kresd.conf, the following parameters are set around root.config.

--root.hints
hints.config("/etc/knot-resolver/named.root")
trust_anchors.config("/etc/knot-resolver/root.keys")

The contents of named.root are as follows.

$ cat named.root 

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @e.root-servers.net . ns
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24742
;; flags: qr aa rd; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 27
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       518400  IN      NS      a.root-servers.net.
.                       518400  IN      NS      b.root-servers.net.
.                       518400  IN      NS      c.root-servers.net.
.                       518400  IN      NS      d.root-servers.net.
.                       518400  IN      NS      e.root-servers.net.
.                       518400  IN      NS      f.root-servers.net.
.                       518400  IN      NS      g.root-servers.net.
.                       518400  IN      NS      h.root-servers.net.
.                       518400  IN      NS      i.root-servers.net.
.                       518400  IN      NS      j.root-servers.net.
.                       518400  IN      NS      k.root-servers.net.
.                       518400  IN      NS      l.root-servers.net.
.                       518400  IN      NS      m.root-servers.net.

;; ADDITIONAL SECTION:
a.root-servers.net.     518400  IN      AAAA    2001:503:ba3e::2:30
b.root-servers.net.     518400  IN      AAAA    2001:500:200::b
c.root-servers.net.     518400  IN      AAAA    2001:500:2::c
d.root-servers.net.     518400  IN      AAAA    2001:500:2d::d
e.root-servers.net.     518400  IN      AAAA    2001:500:a8::e
f.root-servers.net.     518400  IN      AAAA    2001:500:2f::f
g.root-servers.net.     518400  IN      AAAA    2001:500:12::d0d
h.root-servers.net.     518400  IN      AAAA    2001:500:1::53
i.root-servers.net.     518400  IN      AAAA    2001:7fe::53
j.root-servers.net.     518400  IN      AAAA    2001:503:c27::2:30
k.root-servers.net.     518400  IN      AAAA    2001:7fd::1
l.root-servers.net.     518400  IN      AAAA    2001:500:9f::42
m.root-servers.net.     518400  IN      AAAA    2001:dc3::35
a.root-servers.net.     518400  IN      A       198.41.0.4
b.root-servers.net.     518400  IN      A       192.228.79.201
c.root-servers.net.     518400  IN      A       192.33.4.12
d.root-servers.net.     518400  IN      A       199.7.91.13
e.root-servers.net.     518400  IN      A       192.203.230.10
f.root-servers.net.     518400  IN      A       192.5.5.241
g.root-servers.net.     518400  IN      A       192.112.36.4
h.root-servers.net.     518400  IN      A       198.97.190.53
i.root-servers.net.     518400  IN      A       192.36.148.17
j.root-servers.net.     518400  IN      A       192.58.128.30
k.root-servers.net.     518400  IN      A       193.0.14.129
l.root-servers.net.     518400  IN      A       199.7.83.42
m.root-servers.net.     518400  IN      A       202.12.27.33

;; Query time: 84 msec
;; SERVER: 2001:500:a8::e#53(2001:500:a8::e)
;; WHEN: Fri Jul 28 23:30:05 JST 2017
;; MSG SIZE  rcvd: 811

The version is as follows.

$ kresd -V
Knot DNS Resolver, version 1.3.2
vcunat commented 7 years ago

hints.config accepts the format for /etc/hosts, and that's different than zonefile. For loading root hints, i.e. servers that are asked to find the contents of root zone, there's a way, but there's not a direct possibility to read those from zonefile format either: http://knot-resolver.readthedocs.io/en/latest/modules.html#examples

vcunat commented 7 years ago

BTW, we occasionally update the root hint defaults built into kresd and they are currently up to date.

kometchtech commented 7 years ago

I was very sorry. I could not confirm the document accurately. To the end it is set in the form of hosts file.

Also, I acknowledged that the latest version of the built-in root file is set. That means that you do not have to be conscious of it.

I hope to update packages etc. without forgetting it. . .