DNS name resolution in .Net

  • Thread starter Thread starter Rob Levine
  • Start date Start date
R

Rob Levine

Hi All,

Is there any way within .Net to do a DNS lookup ONLY from a given server
about its own DNS records?

I am having a problem with name resolution which is detailed in this post
(posted to m.p.d.l.csharp yesterday):

Thanks in advance for any help,

Rob Levine
-----------------------------------------------------
Hi All,

This is a cut down version of a post from earlier entitled "Name resolution
in .Net". Apologies, for the repeat, but I think the first post was too
verbose (it came from a blog article of mine) and I think a shorter post
here is probably more appropriate.

I am seeing some incorrect behaviour on System.Net.Dns.Resolve( hostname )
It would appear that this does more than just a DNS lookup (which is what it
says in the documentation), at least when resolving the address of the
local machine.

I have a server with two NICs and hence two IP addresses: 10.0.0.5 and
192.168.0.2. Only the latter of these has a DNS entry (mapping to the host
name 'terminus'). The former IP address is not listed anywhere (DNS or hosts
file).
If I call System.Net.Dns.Resolve( 'terminus') from the server itself, I get
both IP addresses coming back. How is this possible if the call is only
doing a DNS lookup? A test with nslookup verifies that the name 'terminus'
has a single A record only, pointing to 192.168.0.2.

My suspision is that this call is also checking the NetBIOS name cache;
"netstat -a terminus" lists the same results as the resolve call. If so,
this is not what the documentation says it does.

Any ideas anyone ?
Is it possible to do a DNS lookup ONLY on a hostname ?

Thanks in advance for any help,

Rob Levine
http://roblevine.blogspot.com
 
Thanks Ivar - much appreciated.
I still find it hard to believe that something as basic and fundamental is
not part of the core framework!

Regards,

Rob
 
Back
Top