P16: a blog by Matt Kangas home archive
11 Feb 2008

OSX Leopard DNS issues, and a workaround

Another tip for MacBook/MacBook Pro owners running OS X 10.5 "Leopard"...

Problem Description

For a little while, I've noticed what seemed to be occasional problems with Safari, the default web browser under OS X. I'll be browsing the web at home via WiFi when suddenly Safari says "You are not connected to the Internet" – but only for a certain (random) website. Other websites are still usable. My IM client suffers no interruption while this is happening, nor does Mail.app.

(Actually, I've seen wierdness with Mail.app too, where it fails to validate the SSL certificate for one or more of my email accounts. This may/may not be related... keep reading.)

This happens when I'm at home, using Time Warner cable via WiFI (Buffalo WHR-G125 re-flashed with DD-WRT Linux). I've seen TWC flakiness in the past, but my other Linux box running Smokeping wasn't showing network dropouts. Hmm.

Background

I went a-Googling yesterday, and found that I'm not the only person seeing these issues...

Safari Internet Connection Problems in Leopard « The Chronicles of Wynn – He doesn't describe the problem, but does suggest a solution: turning off IPV6 support. Ok, but why?

Leopard Internet Connection Problems « One Digital Life – Nice side-by-side screenshot of "flaky Safari 3" and "working Firefox 2". "The error listed in Safari’s Activity Window is, “Can’t find host”"

Leopard DNS Issues (and work-around) « JungleDisk – A discussion of technical issues. DNS behavior did change in Leopard, but the culprit is misconfigured DNS servers? Umm...

How I'm dealing with it (so far)

1) Turn off IPV6

Frankly, I cannot tell if this is having any effect at all.

2) Create a shell script called "dns-flush":

#!/bin/sh
dscacheutil -flushcache

Make that file executable (chmod u+x dns-flush) and run it (./dns-flush) whenever Safari flakes out.

This is helping! Safari immediately stops acting stupid and comes back to life. Unfortunately, I find that I need to run this once every few hours. Does anybody else have a better answer?