Monday, March 23, 2009

Java host caching (sun.net.inetaddr.ttl/networkaddress.cache.ttl) on OS X

On my Mac OS X box I was trying to get some round robin DNS working from Java (1.5) but I was the host was always resolving to the same IP. I'd set sun.net.inetaddr.ttl=0, but that didn't seem to help. It seems out of the box a Mac will cache lookups, but you can clean out the cache with the command dscacheutil -flushcache