DNS lookup always timing out

Discussion to talk about software related topics only.
Post Reply
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

DNS lookup always timing out

Post by v8dave »

Hi all,

I have a call to GetHostByName and it always returns timeout if I set the DNS entry to 0 (docs say to do this to use the allocated DNS)

I print out the IP addresses at the start of the application and I can see the DNS entry is valid. Stepping into the code I can see that it is also using this value but it always times out.

I am connected just now via Ethernet for debugging so it is using the router settings.

If I pass in 192.168.1.1 (which is the router IP) then is works and I get a return from the call.

What am I missing?

By the way, I will be testing it over PPP this weekend once the modem board is built and tested.

Dave...
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: DNS lookup always timing out

Post by rnixon »

I think that the zero setting assumes you are using dhcp (and really applies to the ip address). If your dhcp server does not provide ip, mask, gateway and dns, it won't work. If you use static, you need to set all 4 yourself.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: DNS lookup always timing out

Post by v8dave »

Hi rnixon,

I have code that detects if the DHCP call fails and it then sets all the settings to manual. This is really only for standalone units where the user can hook up a laptop with a cross over cable to reprogramme the system through a simplified browser interface.

I set a flag indicating if Ethernet is active or not from the DHCP failure or pass.

If the system fails DHCP the flag for active connection is not set until the unit has dialled up a PPP connection. At this point I then have a valid IP address and DNS entry. I set the active flag and now the system can send and receive data. This is simply socket based with an IP address that is already known so need for DNS. I only need DNS for the autoupdate checking that it does on the server.

I have not yet tried DNS over PPP as I am waiting on some parts for the modem board to arrived early next week. I have been testing with Ethernet and I can printout the DNS entry and see that it is indeed pointing to the DNS my ISP assigns me but it does not respond and times out.

If I set the DNS to the router, which then uses the ISP it works. I may try later this weekend to fix the DNS to the ISP one and see if this works. I could also try the Google DNS 8.8.8.8 if the first one fails and if this works, it gives me a backup I can implement with the system.

Cheers
Dave...
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: DNS lookup always timing out

Post by rnixon »

Is the gateway ip address properly configured? It doesn't make sense to me that setting the dns to the gateway would work, unless you have an uncommon configuration in which the gateway is your dns server. If 8.8.8.8 does not work, that would be another indication of a routing issue.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: DNS lookup always timing out

Post by v8dave »

Well, the test with 8.8.8.8 failed with timeout so it would appear to be something else at fault.

Why 192.168.1.1 works is strange as that is indeed the gateway. On some devices this also appears as the DNS entry but on my PC It is 202.73.99.2 which is my ISP's DNS. I also use 8.8.8.8 as the back up setting on my router.

Let's see how the PPP goes next week but I would like Ethernet to work too.

Dave...
BillC
Posts: 72
Joined: Tue Oct 13, 2009 6:22 am
Location: Buckinghamshire, UK

Re: DNS lookup always timing out

Post by BillC »

Hi Dave, I have all PC's on my netork setup with fixed IP addresses and set the DNS address to the Gateway/Modem/Router address (a Draytek device), I thought that the modem was intelligent enough to pass this on to the real DNS server for the ISP I use, I am abroad at the moment so cannot check how my Netburner board is set, but I am pretty well certain that it will be set the same way as I recently changed ISP and know that I didnt do any reconfiguration of the netburner.

I hope this helps, Bill
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: DNS lookup always timing out

Post by v8dave »

Thanks Bill,

The problem for me is that I need this to be done via DHCP as I can't guarantee what the clients network will be and the same applies for the GPRS connection via PPP. It needs to work whatever I plug it into and right now, I can't get it to work with my ISP's DNS, even if I manually set the DNS address or use the Google one.

I should have a working modem this week so I will be trying that out. If it works with the modem and I can try a couple of different network to be sure, then for this first installation I can get away with it because I know for certain it will be working with GPRS.

Cheers.
Dave...
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: DNS lookup always timing out

Post by rnixon »

The DHCP protocol is one of the easier ones to trace through. You could try wireshark and look for the DISCOVERY broadcast from the netburner (255.255.255.255), then check for the DHCP OFFER reply from the server. You can then compare these to the ones with your PC that seems to work. RFC 2131, but you can do a google for "dhcp rfc" to get a link.
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: DNS lookup always timing out

Post by v8dave »

Well this is wierd.

I ran the update code this afternoon and it worked with the ISP DNS?

I have not changed anything code wise since I left it running but I noticed on the LCD that the last test to the server was successful but no update was found which is what I expected!

Damn! I hate these type of issues. I'll leave it running for the next few days and see if it still keeps working.

Dave...
Post Reply