Looking at a DNS request in wireshark for www.google.com
and the hex for it is 03 77 77 77 06 67 6f 6f 67 6c 65 03 63 6f 6d 00
Little confused why the first period is 03
(and why it's there), the second is 06
, and the last is 03
答案 0 :(得分:2)
DNS协议层在RFC 1035中定义。引用来自" 3.1。命名空间定义":
消息中的域名以标签序列表示。 每个标签都表示为一个八位字节长度字段,然后是该字段 八位字节数。由于每个域名都以null标签结尾 根,域名以长度为零的字节终止。
因此www.google.com
在DNS数据包中编码为:
03 77 77 77 length 3, "www"
06 67 6f 6f 67 6c 65 length 6, "google"
03 63 6f 6d length 3, "com"
00 length 0 (end of label)