我在 Windows 上有自己的 DNS 服务器:
我的主机文件:
stackoverflow.com IN A 3605 10.0.0.1
stackoverflow.com IN A 3601 127.0.0.1
当我使用此 powershell 命令行测试我的服务器的 A 型或 MX 型多条记录时:
Resolve-DnsName -Server 127.0.0.1 -Name stackoverflow.com -Type A
回复:
Name Type TTL Section IPAddress
---- ---- --- ------- ---------
stackoverflow.com A 3601 Answer 10.0.0.1
stackoverflow.com A 3601 Answer 127.0.0.1
返回的'生存时间' 字段始终是最后一条记录的 ttl 值。但是使用此命令:
>> nslookup -q=A -debug - 127.0.0.1
> stackoverflow.com
Server : UnKnown
Address: 127.0.0.1
------------
Got answer:
HEADER:
opcode = QUERY, id = 3, rcode = NOERROR
header flags: response, want recursion, recursion avail.
questions = 1, answers = 2, authority records = 0, additional = 0
QUESTIONS:
stackoverflow.com, type = A, class = IN
ANSWERS:
-> stackoverflow.com
internet address = 10.0.0.1
ttl = 3605 (1 hour 5 secs)
-> stackoverflow.com
internet address = 127.0.0.1
ttl = 3601 (1 hour 1 sec)
------------
Not authoritative answer
Name: stackoverflow.com
Address: 10.0.0.1
127.0.0.1
完美运行。
我的服务器端返回原始数据:
00000000 4B DD 81 80 00 01 00 02 00 00 00 00 0D 73 74 61 KÝ.........sta
00000010 63 6B 6F 76 65 72 66 6C 6F 77 03 63 6F 6D 00 00 ckoverflow.com..
00000020 01 00 01 C0 0C 00 01 00 01 00 00 0E 15 00 04 0A ...À............
00000030 00 00 01 C0 0C 00 01 00 01 00 00 0E 11 00 04 7F ...À...........
00000040 00 00 01 ...
参考:
* https://technet.microsoft.com/fr-fr/library/jj590781(v=wps.630).aspx
会议:
Powershell version 5
.NET version 4.7.02556
有人可以确认 powershell '解析 DNS 名称'请解释一下命令行数据包错误?谢谢。
观察日期:2018-03-29