我想向我知道其 IP 地址的特定 DNS 服务器发出查询。它是在 Windows 上还是在 *nix 上并不重要。
在 Windows 中,我可以执行以下操作:
C:\Documents and Settings\Anton Daneyko>nslookup superuser.com
Server: DNSs2.Uni-Marburg.DE
Address: 137.248.21.22
Non-authoritative answer:
Name: superuser.com
Address: 64.34.119.12
Run Code Online (Sandbox Code Playgroud)
但这使用本地机器的 DNS 设置。相反,我想查询特定的 DNS 服务器以测试它是否正确响应我的查询或根本响应。
所以它应该是这样的:
nslookup --dns-ip=8.8.8.8 superuser.com
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 nslookup 来查询 google.com 2001:4860:4860::8888,这是谷歌 IPv6 DNS。但我没有得到任何回应,例如连接。总是超时。
当我尝试与 DNS 输入 8.8.8.8(即 IPv4 DNS)相同的过程时,一切正常。
我在这里缺少什么?
附言。我正在使用苹果电脑
编辑:
nslookup google.com 8.8.8.8
Run Code Online (Sandbox Code Playgroud)
给出输出
Non-authoritative answer:
Name: google.com
Address: 216.58.212.46
Run Code Online (Sandbox Code Playgroud)
但
nslookup google.com 2001:4860:4860::8844
Run Code Online (Sandbox Code Playgroud)
给出输出
;; connection timed out; no servers could be reached
Run Code Online (Sandbox Code Playgroud) 我正在尝试根据我的分配说明获取欧洲服务器的权威 DNS 服务器。我查了查怎么做,得到了两种不同的方法。
一种是:
nslookup -type=soa ox.ac.uk
Run Code Online (Sandbox Code Playgroud)
另一个是:
nslookup -type=ns ox.ac.uk
Run Code Online (Sandbox Code Playgroud)
两者都给我这个权威答案部分:
Authoritative answers can be found from:
Run Code Online (Sandbox Code Playgroud)
起初我认为这可能是牛津方面的一项安全功能,也许他们对 nslookup 隐藏了他们的 DNS 地址,以避免对这些服务器的攻击。但我了解到这是一个愚蠢的结论,我在谷歌给我的“欧洲大学”的每所大学都尝试了这些命令,但他们都没有回答我的权威答案。是我输入了错误的命令,是我的电脑出问题了,还是我的 ISP 出问题了?
完整的命令和输出在这里:
Sat Apr 08 23:06 user_name:/Users/user_name $nslookup -type=soa ox.ac.uk
Server: 192.168.1.254
Address: 192.168.1.254#53
Non-authoritative answer:
ox.ac.uk
origin = nighthawk.dns.ox.ac.uk
mail addr = hostmaster.ox.ac.uk
serial = 2017040772
refresh = 3600
retry = 1800
expire = 1209600
minimum = 900
Authoritative answers can be found from:
Sat Apr 08 23:06 user_name:/Users/user_name $nslookup -type=NS ox.ac.uk
Server: 192.168.1.254
Address: …
Run Code Online (Sandbox Code Playgroud) 我在其他地方没有看到这个问题的确切答案,所以我会勇敢地在这里问。我有一个 linode,并为我的主机设置了 DNS A 记录,我将其称为 A.wc.net。当我在 A.wc.net 上使用 nslookup 查找它时,我得到了这样的答案:
# running on A.wc.net:
root@linode (etc ): nslookup A.wc.net
Server: 173.255.243.5
Address: 173.255.243.5#53
** server can't find A.wc.net: NXDOMAIN
Run Code Online (Sandbox Code Playgroud)
但是,在任何其他机器上, nslookup 都会给出正确的结果:
@HomeMac (~ (BARE:master)): nslookup A.wc.net
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: A.wc.net
Address: 173.255.111.911 (number changed for my protection ;-)
Run Code Online (Sandbox Code Playgroud)
另外,如果我在主机 A.wc.net 上运行 dig:
root@linode (etc ): dig @ns1.linode.com A.wc.net
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> @ns1.linode.com A.wc.net
; (2 servers found)
;; global options: +cmd
;; Got …
Run Code Online (Sandbox Code Playgroud) 我使用nslookup从 URL 解析 IP 地址并注意到以下内容:
nslookup https://example.com
Server 192.168.3.214
Address 192.168.3.214#53
Run Code Online (Sandbox Code Playgroud)
最后的#53是什么意思?
我们在 Windows 8 上遇到一个间歇性问题,即 Ping 无法找到主机,但 NSLookup 可以正确解决它。
现在对此进行了网络跟踪,似乎发现了以下内容:
这是否有意义,而且我能做些什么来纠正这种奇怪的行为并使 Win 8 网络堆栈正常运行?
我在其他各种线程中读到过有关此间歇性问题的信息,但似乎仍然没有人有长期的解决方案。
在 linux 上,我可以使用以下命令列出 DNS 表中以“80”结尾的所有条目:
dig axfr my.domain | grep 80
Run Code Online (Sandbox Code Playgroud)
我如何在 Windows 上使用 NSlookup 做到这一点?我试过启动 NSlookup 并输入
ls my.domain
Run Code Online (Sandbox Code Playgroud)
这给了我完整的清单。但是如何像在 linux 上使用 grep 一样过滤结果集?
我试过了:
C:\Users\user>nslookup -ls my.domain | find "80"
*** Invalid option: ls
Run Code Online (Sandbox Code Playgroud)
但它给出了上述错误。
当我nslookup
从 PowerShell 脚本运行时,尽管查找成功,但我总是收到错误(输出到控制台):
PS C:\Windows\system32> $MyOutput = nslookup -q=SOA superuser.com
8.8.4.4 nslookup : Non-authoritative answer: At line:1 char:13
+ $MyOutput = nslookup -q=SOA superuser.com 8.8.4.4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Non-authoritative answer::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Run Code Online (Sandbox Code Playgroud)
这似乎是由于答案不具有权威性造成的。对权威 DNS 服务器进行查找不会返回错误。
在我自己寻找解决方案的尝试中,我找到了这个SO answer。它建议使用Resolve-DNSName命令。不幸的是,这需要 Windows 8.1/Server 2012 R2 并且我的脚本将运行的一些系统是 Windows 7 时代。
用于解释 PowerShell 认为发生错误的原因的奖励积分!
我在某个公共网络上使用公共计算机,想看看nslookup
那里是如何工作的。我尝试set type=ns
了一些网站并收到以下消息:
DNS 请求超时。超时为 2 秒。
然后我尝试set ti=30
了其他一些较低的数字,但得到了相同的消息。
当我在家里尝试同样的事情时,没有这样的超时。
出现此消息的原因可能是什么?我该如何解决?
我打算用 Technitium 设置一个本地 DNS 服务器,并想验证本地 DNS 服务器在查询域时是否返回正确的响应。使用时不起作用nslookup mydomain.com
。我希望这是因为无法从公共/互联网位置访问本地 dns 服务器。
为了排除这是由于我的本地 DNS 服务器无法正常工作(本地)引起的,我想验证至少本地 DNS 服务器在查询我的域时返回正确的 IP 地址。
本地 DNS 服务器127.0.0.1
在端口的本地 IP 地址上运行,5379
因此我尝试了以下命令,然后是它们各自的输出:
nslookup 127.0.0.1 somedomain.com
;; connection timed out; no servers could be reached
nslookup 127.0.0.1:5379 somedomain.com
nslookup: couldn't get address for 'somedomain.com': failure
nslookup http://127.0.0.1:5379 somedomain.com
;; connection timed out; no servers could be reached
nslookup https://127.0.0.1:5379 somedomain.com
;; connection timed out; no servers could be reached
Run Code Online (Sandbox Code Playgroud)
因此,要么测试命令nslookup 127.0.0.1:5379 somedomain.com …
nslookup ×10
dns ×7
networking ×3
command-line ×1
dig ×1
ip ×1
ping ×1
powershell ×1
windows-8 ×1