View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Flushing DNS Cache
PostPosted: Tue Jun 05, 2007 7:04 pm 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
I have a cron job on my knoppmyth box that periodically "ssh's" to a remote linux box. I've noted that when the remote linux box's IP address changes, it can sometimes take up to 24 hours before my knoppmyth box will resolve the remote machine's host name to the new IP address. I suspect the problem is that the knoppmyth box is cacheing the DNS mapping from hostname to IP address. Does anyone know of a way to "flush" to DNS cache, so that the system will re-build the mapping tables? Thanks!

Marc


Top
 Profile  
 
 Post subject: Re: Flushing DNS Cache
PostPosted: Tue Jun 05, 2007 7:23 pm 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
marc.aronson wrote:
I have a cron job on my knoppmyth box that periodically "ssh's" to a remote linux box. I've noted that when the remote linux box's IP address changes, it can sometimes take up to 24 hours before my knoppmyth box will resolve the remote machine's host name to the new IP address. I suspect the problem is that the knoppmyth box is cacheing the DNS mapping from hostname to IP address. Does anyone know of a way to "flush" to DNS cache, so that the system will re-build the mapping tables? Thanks!

Marc
I think you are looking for arp -d <hostname>. This will flush the ARP table of <hostname>'s entries and should solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 9:22 pm 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
Slowtolearn:

Thank you for the pointer to arp. I am not able to run a definitive test, as I rebooted my machine and that, of course, cleared the problem. Having said this, I did an ssh to the remote machine and then ran "arp -a" on the local machine. The only addresses listed where on my LAN (192.168.0.*); the remote machine was not listed. When I ran "arp -d hostname" I got the error message "SIOCDARP(nopub): Network is unreachable".

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 9:48 pm 
Offline
Joined: Tue Mar 22, 2005 9:18 pm
Posts: 1422
Location: Brisbane, Queensland, Australia
Marc

Try a traceroute to the machine you are trying to reach and this may give you some idea where it is falling down.

If that is successful you will then find if you do your arp command that this will now be in the table.

_________________
Girkers


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 8:39 am 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
marc.aronson wrote:
Slowtolearn:

Thank you for the pointer to arp. I am not able to run a definitive test, as I rebooted my machine and that, of course, cleared the problem. Having said this, I did an ssh to the remote machine and then ran "arp -a" on the local machine. The only addresses listed where on my LAN (192.168.0.*); the remote machine was not listed. When I ran "arp -d hostname" I got the error message "SIOCDARP(nopub): Network is unreachable".

Marc
Marc,
Sorry, I must have read your post the wrong way. From the above you have BoxA (your KM system) and BoxB (remote system). BoxA is connecting to BoxB via ssh (ssh <hostname>) and not the other way around, and BoxB is not within your LAN, but is accessed via the 'net.

That being the case, can you describe how BoxB updates it's DNS records? I know that many DNS servers out there can take many hours or even days to update all their records, which sounds like the issue you are describing.

Of course if my assumptions are all wet, please do let me know :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 9:08 am 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
slowtolearn:

You have described my scenario correctly -- I should have been more explicit in my original post. Some more info:

1. Both BoxA (KM system) and BoxB (remote) have dynamic IP addresses, so I use dyndns.com to give them hostnames.

2. Both boxes run a utility every hour called "ddclient" to update dyndns.com anytime their IP addresses change.

3. I have a third box on the same LAN as BoxA that was able to successfully resolve the hostname and "putty" to BoxB. Let's call this third box "BoxA2". It runs Windows. I believe this means that the DNS servers that my ISP points me at were properly updated. Only BoxA (KM system) had the problem.

4. The problem corrected itself after ~24 hours and BoxA (KM system) was once again able to properly resolve BoxB's name to the proper IP address.

5. After another 24 hours BoxB's IP addressed changed again but BoxA was resolving BoxB to the old IP address. I rebooted BoxA. After the reboot BoxA would now resolve BoxB to the proper IP address.

6. When I woke up this morning BoxB had once again had an IP address change. The interesting thing is that this time BoxA (KM system) was properly mapping to BoxB's new IP address.

When I run "arp -a" on BoxA, here is what I get:
Code:
? (192.168.0.1) at 00:09:5B:9B:41:CE [ether] on eth0
aronson-t43 (192.168.0.3) at 00:12:F0:4D:F7:EA [ether] on eth0


So my problem appears to have gone away, but I suspect it will come back at some point. Any ideas would be appreciated.

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 9:36 am 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
marc.aronson wrote:
slowtolearn:

You have described my scenario correctly -- I should have been more explicit in my original post. Some more info:

1. Both BoxA (KM system) and BoxB (remote) have dynamic IP addresses, so I use dyndns.com to give them hostnames.

2. Both boxes run a utility every hour called "ddclient" to update dyndns.com anytime their IP addresses change.
I use the same utility for my Slackware box (HTTP, SMTP/POP servers) to update my zoneedit.com accounts. Works a treat. One idea: Check your syslog file to see if there are any ddclient errors (at least that's where my ddclient stuff is logged) on both BoxA and BoxB.

marc.aronson wrote:
3. I have a third box on the same LAN as BoxA that was able to successfully resolve the hostname and "putty" to BoxB. Let's call this third box "BoxA2". It runs Windows. I believe this means that the DNS servers that my ISP points me at were properly updated. Only BoxA (KM system) had the problem.
Are the DNS servers defined in /etc/resolv.conf on BoxA the same as the DNS servers defined on BoxA2, and in the same order? Along those lines, are the entries for BoxA the same as for BoxB, and in the same order?

marc.aronson wrote:
4. The problem corrected itself after ~24 hours and BoxA (KM system) was once again able to properly resolve BoxB's name to the proper IP address.

5. After another 24 hours BoxB's IP addressed changed again but BoxA was resolving BoxB to the old IP address. I rebooted BoxA. After the reboot BoxA would now resolve BoxB to the proper IP address.

6. When I woke up this morning BoxB had once again had an IP address change. The interesting thing is that this time BoxA (KM system) was properly mapping to BoxB's new IP address.

When I run "arp -a" on BoxA, here is what I get:
Code:
? (192.168.0.1) at 00:09:5B:9B:41:CE [ether] on eth0
aronson-t43 (192.168.0.3) at 00:12:F0:4D:F7:EA [ether] on eth0


So my problem appears to have gone away, but I suspect it will come back at some point. Any ideas would be appreciated.

Marc
Has this been happening all along? Sorry to bring up questions rather than answers. I'm no expert, but it sounds like BoxA may be reading the DNS entries from a different server.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 8:49 am 
Offline
Joined: Tue Jan 18, 2005 2:07 am
Posts: 1532
Location: California
These are good questions. ddclinet is not generatng any error message, and it is working as other machines see the correct IP address for BoxB. I checked /etc/resolve.conf and it contans:

Code:
search hsd1.ca.comcast.net.
nameserver 68.87.76.178
nameserver 68.87.78.130


Unfortunately, I have not been able to figure out what the IP addresses are of the DNS servers being used by my wndows box as it is configured to obtain the DNS server address automatically. My guess is that it is using the same servers.

BoxB changed it's IP address yet again, and everything worked properly. Do you know if hostname to IP address resolution is performed by a process that can be stopped and restarted? If so, I'm wondering if somehow that process sometimes gets into trouble and needs to be restarted...

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 10:00 am 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
marc.aronson wrote:
These are good questions. ddclinet is not generatng any error message, and it is working as other machines see the correct IP address for BoxB. I checked /etc/resolve.conf and it contans:

Code:
[color=red]search hsd1.ca.comcast.net.[/color]
nameserver 68.87.76.178
nameserver 68.87.78.130
The search directive may be causing some trouble. Is this system connected directly to the 'net (not behind a NAT router/firewall)? If hsd1.ca.comcast.net holds the name/IP address for BoxB and is not updated in a timely manner, that could explain what you were seeing.

marc.aronson wrote:
Unfortunately, I have not been able to figure out what the IP addresses are of the DNS servers being used by my wndows box as it is configured to obtain the DNS server address automatically. My guess is that it is using the same servers.
ipconfig /all will show you the DNS servers being used by your Windoze system (and a lot more).

marc.aronson wrote:
BoxB changed it's IP address yet again, and everything worked properly.
Of course! It always works when you're trying to troubleshoot it... :wink: There is the possibility that the DNS server that BoxA used to resolve BoxB's address was not being updated properly and has now been "fixed". Not an unusual occurance at all...

marc.aronson wrote:
Do you know if hostname to IP address resolution is performed by a process that can be stopped and restarted? If so, I'm wondering if somehow that process sometimes gets into trouble and needs to be restarted...
I don't believe so. From man resolv.conf:
Quote:
The resolver is a set of routines in the C library that provide access to
the Internet Domain Name System (DNS). The resolver configuration file
contains information that is read by the resolver routines the first time
they are invoked by a process
.


Sorry I don't have any concrete ideas/solutions for you. I have always found DNS issues to be quite the elusive beast. The next time it fails for you, try Girkers' suggestion of running a traceroute. That may indicate which DNS server is causing the failure.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 07, 2007 1:32 pm 
Offline
Joined: Sat Mar 17, 2007 1:37 am
Posts: 32
sorry, i can't really provide too much help with your DNS issue. hard to troubleshoot from the information provided. but, i'm not sure that it is a caching issue, since you don't have your localhost defined in resolv.conf.

also, you can rule out the ARP stuff. ARP is used for IP to physical (MAC) address translation. And, your ARP table will only ever contain information about your local subnet. Since BoxB is remote, ARP is irrelevant.

_________________
os: knoppmyth r5e50
mobo: asus p5pe-vm
cpu: intel celeron 2.66 d
memory: 256mb ddr ram
video: asus geforce 6200 agp
tuner: hauppauge pvr 150 mce
disk: seagate 250gb sata


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 81 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu