- May 31, 2001
- 32
- 0
- 0
I've got two xp machines with hostnames 'machine1' and 'machine2' on my local network. Both machines are set up for automatic configuration via DHCP. My DHCP server assigns the suffix 'domain.com', and assigns my local DNS server. So both machines are using 192.162.0.1 as their primary DNS server. (I'm using a WRT54G router with dhcpd and DNSmasq installed. The 'Local DNS' option is turned on which allows the DNS server to resolve DHCP hostnames.)
Machine1 works great and can nslookup and ping machine2 using both 'machine2' or 'machine2.domain.com'. Machine2 can nslookup machine1 just fine, but ping fails. Trying to ping machine1 from machine2 gives the following error message:
Ping request could not find host machine1. Please check the name and try again.
I wrote a small console app named resolve.exe in C# to test DNS resolution in an application:
using System;
public class Resolver {
public static void Main(String[] args) {
try {
string ipaddress =
System.Net.Dns.Resolve(args[0]).AddressList[0].ToString();
Console.WriteLine(ipaddress);
}
catch(Exception ex) { Console.WriteLine(ex.ToString()); }
}
}
If I execute the following sequence of commands from machine2, this is what happens:
nslookup machine1.domain.com /* success */
resolve machine1.domain.com /* success */
ping machine1.domain.com /* fails */
resolve machine1.domain.com /* fails */
nslookup machine1.domain.com /* success */
ipconfig /flushdns
resolve machine1.domain.com /* success */
ping machine1.domain.com /* fails */
nslookup machine1.domain.com /* success */
resolve machine1.domain.com /* fails */
resolve machine1 /* success */
ping machine1 /* fails */
resolve machine1 /* fails */
This is what I have gathered from this:
Resolve works great on a hostname right up until a program attempts to connect to that particular hostname. At this point a negative entry for this hostname is entered into the cache, but why? And why does nslookup not care about that? Can somebody help me figure out what the hell is going on here? And why does machine1 work just fine?
Machine1 works great and can nslookup and ping machine2 using both 'machine2' or 'machine2.domain.com'. Machine2 can nslookup machine1 just fine, but ping fails. Trying to ping machine1 from machine2 gives the following error message:
Ping request could not find host machine1. Please check the name and try again.
I wrote a small console app named resolve.exe in C# to test DNS resolution in an application:
using System;
public class Resolver {
public static void Main(String[] args) {
try {
string ipaddress =
System.Net.Dns.Resolve(args[0]).AddressList[0].ToString();
Console.WriteLine(ipaddress);
}
catch(Exception ex) { Console.WriteLine(ex.ToString()); }
}
}
If I execute the following sequence of commands from machine2, this is what happens:
nslookup machine1.domain.com /* success */
resolve machine1.domain.com /* success */
ping machine1.domain.com /* fails */
resolve machine1.domain.com /* fails */
nslookup machine1.domain.com /* success */
ipconfig /flushdns
resolve machine1.domain.com /* success */
ping machine1.domain.com /* fails */
nslookup machine1.domain.com /* success */
resolve machine1.domain.com /* fails */
resolve machine1 /* success */
ping machine1 /* fails */
resolve machine1 /* fails */
This is what I have gathered from this:
Resolve works great on a hostname right up until a program attempts to connect to that particular hostname. At this point a negative entry for this hostname is entered into the cache, but why? And why does nslookup not care about that? Can somebody help me figure out what the hell is going on here? And why does machine1 work just fine?