How can I access Windows shares after changing DNS servers (e.g. switching to OpenDNS)?

I'm on Maverick trying to access shared folders hosted on Windows machines across a home network. Mysteriously I stopped being able to see them through Nautilus (I couldn't even open Windows network and see my own machine), nor using "smbclient -L //HOSTNAME" from the command line. The error code I got was NT_STATUS_UNSUCCESSFUL.


I discovered the problem was I had recently started using OpenDNS and Samba resolves local hostnames using DNS. Of course, OpenDNS can't resolve my local network hostnames.

The solution is to edit your Samba configuration so that the hostnames are resolved locally and then restart Samba:

  1. Edit /etc/samba/smb.conf (To edit it within the terminal, run sudo nano /etc/samba/smb.conf. To edit it within gedit, aka Text Editor, run gksu gedit /etc/samba/smb.conf from the terminal.)

  2. Change the line

    ; name resolve order = lmhosts host wins bcast
    to
    name resolve order = lmhosts wins bcast host
    (note remove semicolon and change order)
  3. Restart Samba from the terminal:

    • Maverick and later: "sudo restart smbd"
    • Lucid and before: "/etc/init.d/samba restart"