Samba not working on LAN without internet connection

I get the exact same situation as yours -- Samba in LAN works well when WAN port is up, but is painfully slow if WAN port is down. I finally figured out why with tcpdump.

Samba tries to resolve its hostname.

My Samba server does not have its own hostname entry in /etc/hosts, so it tries to resolve it on the Internet, this takes a long time if WAN is down.

Add your Samba server's A / PTR record to your LAN nameserver (which is used by Samba), or just add a hostname entry to /etc/hosts on Samba. No more green progress bars!


The fact that you use ip address to mount share doesn't mean there is no name resolution involved.
There is such a thing as reverse name resolution.
This happens when client is trying to figure out FQDN of the server based on it's IP. (think dig -x ipaddress kind of deal)

For a quick test I suggest to add some name to the IP address of a share on a client C:\Windows\system32\drivers\etc\hosts file and see if this helps.
You can find detailed instructions with examples for example here https://support.rackspace.com/how-to/modify-your-hosts-file/

You can also install wireshark on the client and capture network traffic at the time you have a problem. Then filter by port 53 (DNS). You should see if there is any reverse name resolution going on.