DNS/KnotResolver/cookies/query_exampleについて、ここに記述してください。
configにsampleのcookie moduleの取り込みを追加してから、
kresd -v --addr=127.0.0.3
で動かしています。cookieが有効であることが判明しているns1.inet.ad.jpに問い合わせる。
$ kdig ns1.inet.ad.jp @127.0.0.3
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 51297 ;; Flags: qr rd ra; QUERY: 1; ANSWER: 1; AUTHORITY: 0; ADDITIONAL: 0 ;; QUESTION SECTION: ;; ns1.inet.ad.jp. IN A ;; ANSWER SECTION: ns1.inet.ad.jp. 86262 IN A 153.121.42.26 ;; Received 48 B ;; Time 2017-04-13 10:28:23 JST ;; From 127.0.0.3@53(UDP) in 0.3 ms
kdigは未対応で表示されないが、内部の動作ではcookie有効で動作しているらしい。
1. [cookies] cookie cached
[ 0][plan] plan 'ns1.inet.ad.jp.' type 'A' [ 1039][iter] 'ns1.inet.ad.jp.' type 'A' id was assigned, parent id 0 [ 1039][resl] => using root hints [64702][iter] 'ns1.inet.ad.jp.' type 'A' id was assigned, parent id 0 [64702][resl] => querying: '202.12.27.33' score: 10 zone cut: '.' m12n: 'jP.' type: 'NS' proto: 'udp' [64702][iter] <= using glue for 'd.dns.jp.': '210.138.175.244' [64702][iter] <= using glue for 'e.dns.jp.': '192.50.43.53' [64702][iter] <= using glue for 'c.dns.jp.': '156.154.100.5' [64702][iter] <= using glue for 'h.dns.jp.': '65.22.40.25' [64702][iter] <= using glue for 'f.dns.jp.': '150.100.6.8' [64702][iter] <= using glue for 'b.dns.jp.': '202.12.30.131' [64702][iter] <= using glue for 'g.dns.jp.': '203.119.40.1' [64702][iter] <= using glue for 'a.dns.jp.': '203.119.1.1' [64702][iter] <= referral response, follow [64702][resl] <= server: '202.12.27.33' rtt: 139685221367815 ms [26866][iter] 'ns1.inet.ad.jp.' type 'A' id was assigned, parent id 0 [26866][resl] => querying: '65.22.40.25' score: 10 zone cut: 'jp.' m12n: 'Ad.jP.' type: 'NS' proto: 'udp' [26866][iter] <= rcode: NOERROR [26866][iter] <= found cut, retrying with non-minimized name [26866][ pc ] => answer cached for TTL=900 [26866][resl] <= server: '65.22.40.25' rtt: 139685221367977 ms [50181][iter] 'ns1.inet.ad.jp.' type 'A' id was assigned, parent id 0 [50181][resl] => querying: '203.119.40.1' score: 10 zone cut: 'jp.' m12n: 'Ns1.inet.ad.JP.' type: 'A' proto: 'udp' [50181][iter] <= using glue for 'ns1.inet.ad.jp.': '153.121.42.26' [50181][iter] <= using glue for 'ns2.inet.ad.jp.': '49.212.54.233' [50181][iter] <= referral response, follow [50181][resl] <= server: '203.119.40.1' rtt: 139685221367814 ms [ 1074][iter] 'ns1.inet.ad.jp.' type 'A' id was assigned, parent id 0 [ 1074][resl] => querying: '49.212.54.233' score: 10 zone cut: 'inet.ad.jp.' m12n: 'NS1.inET.ad.jP.' type: 'A' proto: 'udp' [ 0][cookies] cookie cached [ 1074][iter] <= rcode: NOERROR [ 1074][resl] <= server: '49.212.54.233' rtt: 139685221367825 ms [ 0][resl] finished: 4, queries: 1, mempool: 16400 B
2. dig の返答でもcookieが返る。
$ dig ns1.inet.ad.jp @127.0.0.3
; <<>> DiG 9.11.0-P3 <<>> ns1.inet.ad.jp @127.0.0.3 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2205 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: 5992cb13928bb5f0e2281d3958eed650dd6af8afccfc08b2 (good) ;; QUESTION SECTION: ;ns1.inet.ad.jp. IN A ;; ANSWER SECTION: ns1.inet.ad.jp. 3117 IN A 153.121.42.26 ;; Query time: 0 msec ;; SERVER: 127.0.0.3#53(127.0.0.3) ;; WHEN: Thu Apr 13 10:37:20 JST 2017 ;; MSG SIZE rcvd: 87
3. 直接のqueryの返事
異なる cookieが見える。
$ dig ns1.inet.ad.jp @ns1.inet.ad.jp
; <<>> DiG 9.11.0-P3 <<>> ns1.inet.ad.jp @ns1.inet.ad.jp ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63755 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: 331094fda0d2160de73fcb3058eed6ab2f1dce41858833d1 (good) ;; QUESTION SECTION: ;ns1.inet.ad.jp. IN A ;; ANSWER SECTION: ns1.inet.ad.jp. 3600 IN A 153.121.42.26 ;; AUTHORITY SECTION: inet.ad.jp. 3600 IN NS ns2.inet.ad.jp. inet.ad.jp. 3600 IN NS ns1.inet.ad.jp. ;; ADDITIONAL SECTION: ns2.inet.ad.jp. 3600 IN A 49.212.54.233 ;; Query time: 7 msec ;; SERVER: 153.121.42.26#53(153.121.42.26) ;; WHEN: Thu Apr 13 10:38:51 JST 2017 ;; MSG SIZE rcvd: 135