DNS recursive query iterative query 2 DNS 1www

  • Slides: 28
Download presentation

DNSの動作 recursive query iterative query (2) ローカルのDNSサーバ (1)www. kyushu-u. ac. jp (6)133. 5. 1.

DNSの動作 recursive query iterative query (2) ローカルのDNSサーバ (1)www. kyushu-u. ac. jp (6)133. 5. 1. 2 DNSクライアント (3) . (root) DNSサーバ jp DNSサーバ (4) (5) ac. jp DNSサーバ kyushu-u. ac. jp DNSサーバ 6

DNSの拡張 (1)差分ゾーン転送    RFC 1995, “Incremental Zone Transfer in DNS” (2)ゾーンの更新通知    RFC 1996, “A Mechanism

DNSの拡張 (1)差分ゾーン転送    RFC 1995, “Incremental Zone Transfer in DNS” (2)ゾーンの更新通知    RFC 1996, “A Mechanism for Prompt Notification of Zone Changes (DNS NOTIFY)” (3)DNSの動的更新    RFC 2136, “Dynamic Updates in the Domain Name System (DNS UPDATE)” 7

利用例(DHCPとDynamic DNS) Hw Address | Host Name table DHCP Server 1 allocate IP address

利用例(DHCPとDynamic DNS) Hw Address | Host Name table DHCP Server 1 allocate IP address DHCP Client 2 send IP-Host infomation DNS 3 DNS update [松澤ら, 2000] 11

DNS UPDATEパケットの構造 Header Zone Prerequisite Update Additional Data specifies the zone to be updated

DNS UPDATEパケットの構造 Header Zone Prerequisite Update Additional Data specifies the zone to be updated RRs or RRsets which must (not) preexist RRs or RRsets to be added or deleted additional data RRset: ・RRのエントリ(name, type, class, ttl, rdlength, rdata)のうち (name, type, class)が同じRRの集合 12

Headerセクション(1) 00 01 02 03 04 05 06 07 08 09 10 11 12

Headerセクション(1) 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 ID QR Opcode Z RCODE ZOCOUNT PRCOUNT UPCOUNT ADCOUNT ID: 要求を行うプログラムによって割り当てられる識別子 QR: 要求(0)、応答(1) Opcode: 要求の種類、UPDATE(5) Z: 予約、すべて 0にセット 13

Headerセクション(2) RCODE: 応答コード 0 NOERROR 1 FORMERR 2 SERVFAIL 3 NXDOMAIN 4 NOTIMP 5

Headerセクション(2) RCODE: 応答コード 0 NOERROR 1 FORMERR 2 SERVFAIL 3 NXDOMAIN 4 NOTIMP 5 REFUSED YXDOMAIN YXRRSET NOTAUTH NOTZONE 6 7 8 9 10 ZOCOUNT: Zoneセクションに含まれるRRの数 PRCOUNT: Prerequisiteセクションに含まれるRRの数 UPCOUNT: Updateセクションに含まれるRRの数 ADCOUNT: Additional Dataセクションに含まれるRRの数 14

Prerequisiteセクション ・更新するための必要条件を指定  (1)RRset exists (value independent)  (2)RRset exists (value dependent)  (3)RRset dose not exist

Prerequisiteセクション ・更新するための必要条件を指定  (1)RRset exists (value independent)  (2)RRset exists (value dependent)  (3)RRset dose not exist  (4)Name is in use  (5)Name is not in use <構文> class type ANY ANY rrset NONE ANY NONE rrset zone rrset rdata empty rr meaning (4) (1) (5) (3) (2) ※ttlはすべて 0   にセット 16

Updateセクション ・更新(追加・削除)するRRまたはRRsetを指定  (1)Add RRs to an RRset  (2)Delete an RRset  (3)Delete all RRsets from

Updateセクション ・更新(追加・削除)するRRまたはRRsetを指定  (1)Add RRs to an RRset  (2)Delete an RRset  (3)Delete all RRsets from a name  (4)Delete an RR from an RRset <構文> class ANY NONE zone type ANY rrset rdata empty rr rr meaning (3) (2) (4) (1) ※(1)以外、ttlは   すべて 0にセット 17

Requestor Behavior 前提:  ・更新するゾーンの名前と当該ゾーンのDNSサーバ   (プライマリまたはセカンダリ)は既知 DNS UPDATEパケット ID: Opcode: Zone zcount: Zone zname: Zone

Requestor Behavior 前提:  ・更新するゾーンの名前と当該ゾーンのDNSサーバ   (プライマリまたはセカンダリ)は既知 DNS UPDATEパケット ID: Opcode: Zone zcount: Zone zname: Zone zclass: Zone type: Prerequisite Section: Update Section: Additional Data Section: (new) UPDATE 1 (zone name) (zone class) T_SOA (see previous page) (empty) 20

実装(BIND) BIND(Berkeley Internet Name Domain)  (1)DNSのリファレンス実装  (2)ISC(Internet Software Consortium)により開発・配布  (3)BIND 4系、BIND 8系、BIND 9系が存在  (4)Dynamic

実装(BIND) BIND(Berkeley Internet Name Domain)  (1)DNSのリファレンス実装  (2)ISC(Internet Software Consortium)により開発・配布  (3)BIND 4系、BIND 8系、BIND 9系が存在  (4)Dynamic DNSはBIND 8系とBIND 9系でサポート    (A)BIND 8系の最新版は 8. 2. 5    (B)BIND 9系の最新版は 9. 2. 0 21

ソースコード(1) $DISTDIR/bind_src/bin/named/ns_update. c /* Process zone section. */. . . if (zocount != 1

ソースコード(1) $DISTDIR/bind_src/bin/named/ns_update. c /* Process zone section. */. . . if (zocount != 1 || type != T_SOA) {. . . hp->rcode = FORMERR; return (Finish); }. . . /* we should be authoritative */ if (!(zp->z_flags & Z_AUTH)) {. . . hp->rcode = NOTAUTH; return (Finish); } 22

ソースコード(2) $DISTDIR/bind_src/bin/named/ns_update. c if (zp->z_type == Z_SECONDARY) { /* * XXX The code below

ソースコード(2) $DISTDIR/bind_src/bin/named/ns_update. c if (zp->z_type == Z_SECONDARY) { /* * XXX The code below is broken. * Until fixed, we just return NOTIMPL. */ #if 1 hp->rcode = ns_r_notimpl; return (Finish); #else /* We are a slave for this zone, forward it to the master. */. . . #endif } /* * We are the primary master server for this zone, * proceed further and process update packet */. . . 23

動作テスト環境 BSD/OS 3. 1上でBIND 8. 2. 5(named)を走行  <設定ファイル>   (1)/etc/named. conf   (2)/etc/namedb/localhost. rev   (3)/etc/namedb/named. hosts

動作テスト環境 BSD/OS 3. 1上でBIND 8. 2. 5(named)を走行  <設定ファイル>   (1)/etc/named. conf   (2)/etc/namedb/localhost. rev   (3)/etc/namedb/named. hosts   (4)/etc/namedb/named. rev   (5)/etc/namedb/named. root   (6)/etc/resolv. conf  <http: //www. swlab. csce. kyushu-u. ac. jp/~yamamoto/ds/settings/> ・BIND 8. 2. 5付属の動的更新ツール(nsupdate)を使用して、 A RR(正引き)の更新(削除・追加) 24

動作テスト結果(1) (fubuki)</etc/namedb>$ nslookup Default Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5.

動作テスト結果(1) (fubuki)</etc/namedb>$ nslookup Default Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 115 > tender. yamamoto. csce. kyushu-u. ac. jp Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 115 Name: tender. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 108 > (Ctrl-D) (fubuki)</etc/namedb>$ nsupdate > update delete tender. yamamoto. csce. kyushu-u. ac. jp IN A > > (Ctrl-D) 25

動作テスト結果(2) (fubuki)</etc/namedb>$ nslookup Default Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5.

動作テスト結果(2) (fubuki)</etc/namedb>$ nslookup Default Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 115 > tender. yamamoto. csce. kyushu-u. ac. jp Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 115 *** fubuki. yamamoto. csce. kyushu-u. ac. jp can't find tender. yamamoto. csce. kyushu-u. ac. jp: Non-existent host/domain > (Ctrl-D) (fubuki)</etc/namedb>$ nsupdate > update add tender. yamamoto. csce. kyushu-u. ac. jp 1200 IN A 133. 5. 22. 105 > > (Ctrl-D) 26

動作テスト結果(3) (fubuki)</etc/namedb>$ nslookup Default Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5.

動作テスト結果(3) (fubuki)</etc/namedb>$ nslookup Default Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 115 > tender. yamamoto. csce. kyushu-u. ac. jp Server: fubuki. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 115 Name: tender. yamamoto. csce. kyushu-u. ac. jp Address: 133. 5. 22. 105 > (Ctrl-D) ※PTR RR(逆引き)は、別途更新(削除・追加)する必要あり 27

動作テスト結果(4) (fubuki)</etc/namedb>$ cat named. hosts. log ; BIND LOG V 8 [DYNAMIC_UPDATE] id 31008

動作テスト結果(4) (fubuki)</etc/namedb>$ cat named. hosts. log ; BIND LOG V 8 [DYNAMIC_UPDATE] id 31008 from [133. 5. 22. 115]. 1038 at 1008069068 (named pid 75): zone: origin yamamoto. csce. kyushu-u. ac. jp class IN serial 2001121101 update: {delete} tender. yamamoto. csce. kyushu-u. ac. jp. IN A [INCR_SERIAL] from 2001121101 to 2001121102 Tue Dec 11 20: 12: 00 2001 [DYNAMIC_UPDATE] id 38668 from [133. 5. 22. 115]. 1053 at 1008069281 (named pid 75): zone: origin yamamoto. csce. kyushu-u. ac. jp class IN serial 2001121102 update: {add} tender. yamamoto. csce. kyushu-u. ac. jp. 1200 IN A 133. 5. 22. 105 [INCR_SERIAL] from 2001121102 to 2001121103 Tue Dec 11 20: 19: 41 2001 28