如何获取指定主机名的DNS别名? [英] How to get DNS aliases of specified host name?

查看:46
本文介绍了如何获取指定主机名的DNS别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取有关指定主机名的 DNS 别名的信息.我用过:

I am tying to get information about DNS aliases of specified host name. I used :

IPHostEntry hostEntry = Dns.GetHostEntry("hostname")

不幸的是,正如 MSDN 中提到的:

Unfortunately as mentioned in MSDN:

返回的 IPHostEntry 实例的 Aliases 属性不会由该方法填充,并且将始终为空.

The Aliases property of the IPHostEntry instance returned is not populated by this method and will always be empty.

我打算以这种方式获取 DNS 别名:

I plan to get DNS aliases such way:

  1. 在注册表SYSTEM\CurrentControlSet\Services\Tcpip\Parameter中获取DNS服务器的ipAddresses.

  1. get ipAddresses of DNS server in registry SYSTEM\CurrentControlSet\Services\Tcpip\Parameter.

使用 DNS WMI 提供程序获取 DNS 服务器中的 CNAME 记录.但在这种情况下,需要访问 DNS 服务器的权限.

use DNS WMI provider to get CNAME records in the DNS server. But in this case permissions for access to the DNS server are requiered.

我的计划正确吗?有没有其他方法可以在没有 DNS 服务器权限的情况下获取 CNAME 记录?

Is my plan correct? Is there another way to get CNAME records without permission to DNS server?

推荐答案

DNS Lookup 项目值得注意的是它有一个名为 DnsProvider 的二级类,它提供了从系统获取 DNS 服务器的正确"方式,而无需使用注册表.

Worth noting about the DNS Lookup project is it got a secondary class called DnsProvider which provides the "proper" way of getting the DNS servers from the system without using the registry.

http://dnslookup.codeplex.com/wikipage?title=Usage&referringTitle=Documentation了解更多信息.

这篇关于如何获取指定主机名的DNS别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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