Home > Network, OS X > Mountain Lion DNS Issues (and SMB)

Mountain Lion DNS Issues (and SMB)

I’ve been incredibly frustrated by how poorly DNS resolves since upgrading first to Lion, then later to Mountain Lion (on a new machine, but migrating my old files). The impact of this was particularly bad connecting to SMB/CIFS/Samba shares – some would mount after several minutes, others not at all.

Early on it became clear the problems were related to my router (DDWRT) not supporting IPv6 but then neither does my ISP. Here are a few things to try:

DNS Resolver Order

Normally /etc/hosts is first in line for DNS resolution. But it seems improper line termination, presumably a carriage return/linefeed instead of just a linefeed, causes all sorts of problems. Many posts describe ways to force reloading of the hosts file, but the root cause seems to be improper line termination. Always make sure you use a Unix compatible editor.

To check the order resolvers are called:

scutil --dns

/etc/hosts Entries

These two were the main source of my problems:

1. My host has multiple names – these must all be present, and fully qualified: hosta hosta.foo.com hostb hostb.foo.com

2. All localhost entries must have ::1 entries too, or OS X will send IPv6 requests to resolve them externally. And this despite IPv6 being disabled on the interface!

::1 hosta hosta.foo.com
::1 hostb hostb.foo.com

Turn off IPv6 in Network Preferences

Go to System Preferences -> Network -> Advanced -> TCP. In the Configure IPv6 list, you may have an “Off” option. If so, select it. If not, see next tip.

Turn off IPv6 from Terminal

List available network services:

networksetup -listallnetworkservices

Turn off IPv6 on chosen device (name from above list):

networksetup -setv6off your_device_name (i.e. Wi-Fi, Ethernet)

Now the Configure IPv6 list  for that device will show “Off”  (see previous tip).

MobileMe Remnants

Apparently older OS X installations migrated to newer releases may still have hooks to no-longer existant MobileMe servers. Many users report that removing these greatly speeds up SMB connection. The following removes those references if present and are harmless if not.

defaults delete -g iToolsMemberDomain
defaults delete -g iToolsMember


Categories: Network, OS X Tags: , , , , , , , , , , , ,
  1. May 21st, 2013 at 11:40 | #1

    Don’t suppose you’ve make any other discoveries. ML is frustrating, some apps seems to resolve dns differently aswell. a call to dig returns entries instantly, other utilities like ping or even google chrome take ages to resolve.

    • peterk
      May 21st, 2013 at 12:42 | #2

      The above fixes cured most of the problems I was having. In particular, Chrome now works well, resolving names virtually instantly. The only significant delays remaining are when connecting to Linux SMB servers, and even these take under 5 seconds.

      I used tcpdump and Wireshark to track down most of the delays, especially those related to IPv6 name resolution – perhaps that might work for you too.

  1. No trackbacks yet.