繁体   English   中英

dig(DNS Lookup)在Windows上指定DNS服务器

[英]dig (DNS Lookup) specify DNS server on Windows

在Linux中,我将使用dig使用以下命令指定127.0.0.1的DNS服务器:

dig google.com @127.0.0.1

我安装了Windows的Bind工具( choco install bind-toolsonly )。 我该如何运行相同的命令? 我收到以下错误:

PS C:\Users\jhilden> dig google.com @127.0.0.1
At line:1 char:21
+ dig google.com @127.0.0.1
+                     ~
Missing property name after reference operator.
At line:1 char:16
+ dig google.com @127.0.0.1
+                ~~~~
The splatting operator '@' cannot be used to reference variables in an
expression. '@127' can be used only as an argument to a command. To
reference variables in an expression use '$127'.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingPropertyName

我知道这个答案不会使用Bind工具,正如您在问题中推断的那样。 也就是说,PowerShell附带Resolve-DnsName来执行此任务。 我相信以下命令会做你想要的

Resolve-DnsName -Name google.com -Server 127.0.0.1

就像错误消息所说: @在PowerShell中有特殊含义 逃避角色

dig google.com `@127.0.0.1

或者将参数放在引号中

dig google.com "@127.0.0.1"

我认为你的参数是倒退的。 服务器应该先来。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM