[System.Net.Dns] :: GetHostEntry方法将IP解析为HOSTNAME而没有PTR记录? [英] [System.Net.Dns]::GetHostEntry method resolves IP to HOSTNAME without PTR record?

查看:345
本文介绍了[System.Net.Dns] :: GetHostEntry方法将IP解析为HOSTNAME而没有PTR记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Dns.GetHostEntry 方法从DNS服务器获取给定IP的HOSTNAME。

I am trying to use Dns.GetHostEntry method to get the HOSTNAME for a given IP from the DNS server.

根据文档,该方法首先尝试对IP地址进行反向查找。在我的情况下,当我使用 Dns.GetHostEntry

According to the documentation, the method first tries to do a reverse lookup on the IP address. In my case this is always successful when I use Dns.GetHostEntry.

现在,奇怪的是,同样的IP nslookup不给我任何东西。它会超时或给我错误: UnKnown找不到10.4.202.16:不存在的域。当我查看DNS服务器(2008 R2)时,在反向查找区域中找不到任何PTR记录。所以nslookup失败的事实并不让我感到惊讶。

Now, the strange thing is that for the same IP nslookup doesn't give me anything. It either times out or gives me error: UnKnown can't find 10.4.202.16: Non-existent domain. When I look into the DNS server (2008 R2), I can not find any PTR records in de reverse lookup zone. So the fact that nslookup fails doesn't surprise me much.

但是这里发生了什么?

But what is going on here? Is Dns.GetHostEntry using some undocumented ways to obtain the HOSTNAME?

推荐答案

>那些metods有错误: http://blog.tyang.org/2011/04/15/problem-with-dns-name-resolution-when-using-system-net-dns-class/ 我建议使用上面的解决方案5。

Those metods have bugs: http://blog.tyang.org/2011/04/15/problem-with-dns-name-resolution-when-using-system-net-dns-class/ I suggest to use Solution 5 from above post.

这篇关于[System.Net.Dns] :: GetHostEntry方法将IP解析为HOSTNAME而没有PTR记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆