■一般にUDP53番が使われるが、ゾーン転送だけは信頼性を重視し、
TCP53番が使われるので注意
0 4 8 12 16 20 24 28 31 ---------------------------------- Identification | Flag ---------------------------------- QDCount | ANCount ---------------------------------- NSCount | ARCount ----------------------------------
QDCount: 質問の項目数
ANCount: 回答の項目数
NSCount: オーソリティの項目数
ARCount: 追加情報の項目数
Flags:
QRフラグ(1bit):0は問合せ。1だと応答メッセージ
Opcode(4bit): 0/標準問合せ 1/逆問合せ 2/サーバー状態要求 3-15/未使用
AA(1bit)
TC(1bit)
RD(1bit)
RA(1bit)
Res(3bit)
RCode(4bit): 0/エラーなし 1/フォーマットエラー
2/サーバー障害 3/ドメインが存在しない
4/未実装 5/拒絶
6~15/未使用
■リソースレコードのフォーマット
0 4 8 12 16 20 24 28 31
----------------------------------
Name(名前)
----------------------------------
QType | QClass
----------------------------------
TTL(resolvでの保存期間)
----------------------------------
RDLength | RData
(ここにいろんな情報が入る)
----------------------------------
【QTypeコード】
1 A ホストアドレス 5 CNAME エイリアス 15 MX メールエクスチェンジャー 2 NS オーソリティネームサーバー 12 PTR ドメイン名スペースへのポインタ 6 SOA オーソリティゾーンの起点 252 AXFR ゾーン全体の転送要求 254 MAILB メールボックス関連レコードの要求【QClassコード】
1 IN インターネットシステム 3 CH カオスシステム 155 * 全レコードの要求
■名前解決要求パケット
Transaction ID: 0x0004
質問セクション
www.example.local: type A, class inet
QName: www.example.local
QType: Host address
QClass: inet0000 00 01 80 05 6b 43 00 01 80 04 d3 fa 08 00 45 00 ....kC........E.
0010 00 3e 51 78 00 00 80 11 b4 b6 0a 00 10 7d 0a 00 .>Qx.........}..
0020 10 04 06 91 00 35 00 2a bc 4d 00 04 01 00 00 01 .....5.*.M......
----- ----- -----
ID Flags QDC
0030 00 00 00 00 00 00 03 77 77 77 08 64 65 6b 6f 62 .......www.examp
----- ----- ----- -----------------------------
ANC NSC ARC . w w w . e x a m p
0040 6f 6b 6f 03 63 6f 6d 00 00 01 00 01 le.locl.....
----------------------- ----- -----
l e . l o c l Nu QType QClass
■名前解決応答パケット
Domain Name System (response)
Transaction ID: 0x0004
Flags: 0x8180 (Standard query response, No error)
Response: Message is a response
Opcode: Standard query (0)
Authoritative: Server is not an authority for domain
Truncated: Message is not truncated
Recursion desired: Do query recursively
Recursion available: Server can do recursive queries
Answer authenticated: Answer/authority portion was not authenticated by the server
Reply code: No error (0)
Questions: 1
Answer RRs: 2
Authority RRs: 0
Additional RRs: 0
Queries
www.example.local: type A, class inet
Name: www.example.local
Type: Host address
Class: inet
回答セクション
www.example.local: type CNAME, class inet, cname hoge.example.local
Name: www.example.local
Type: Canonical name for an alias
Class: inet
Time to live: 5 hours, 26 minutes, 28 seconds
Data length: 7
Primary name: hoge.example.local
hoge.example.local: type A, class inet, addr 192.168.0.1
Name: hoge.example.local
Type: Host address
Class: inet
Time to live: 21 hours, 41 minutes, 28 seconds
Data length: 4
Addr: 192.168.0.10000 00 01 80 04 d3 fa 00 01 80 05 6b 43 08 00 45 00 ..........kC..E.
0010 00 61 00 2a 00 00 80 11 05 e2 0a 00 10 04 0a 00 .a.*............
0020 10 7d 00 35 06 91 00 4d eb 01 00 04 81 80 00 01 .}.5...M........
----- ----- -----
ID Flags QDC
.
0030 00 02 00 00 00 00 03 77 77 77 08 64 65 6b 6f 62 .......www.examp
----- ----- ----- -----------------------------
ANC NSC ARC . w w w . e x a m p
0040 6f 6b 6f 03 63 6f 6d 00 00 01 00 01 c0 0c 00 05 le.locl.........
----------------------- ----- ----- -----
l e . l o c l Nu Qtype QClas .
0050 00 01 00 00 4c 84 00 07 04 7a 61 6b 75 c0 10 c0 ....L....hoge...
0060 2e 00 01 00 01 00 01 31 08 00 04 2b f4 22 26 .......1...+."&
