Unable to connect to a Linux Samba server via hostname on Windows 10
Solution 1:
Your issue is local DNS related and breaks down in the following way:
-
A more in-depth discussion in the FreeNAS Forum thread: SMB shares not showing in network browsing
- Local Domain must be set in the Router and echoed across all LAN devices (#23)
- In Windows, this would be the WorkGroup name
- Static IP and Hostname must be set in the Router for the Samba Server (#30)
- Windows'
hosts
file must have an entry in it for the Samba Server (#27)- Format (see #6 below):
IP Hostname Hostname.LocalDomain
- Format (see #6 below):
- Traffic must be allowed on the correct TCP & UDP ports (#27)
- Local Domain must be set in the Router and echoed across all LAN devices (#23)
To Resolve:
- Ensure the Windows device, Samba Server, and Router serving local DNS are set to the same Local Domain
- Router: Local Domain will be the name set under Domain in its WebAdmin UI
- Samba Server: Will depend on the OS
-
Windows: Local Domain is the Workgroup name:
-
Control Panel\All Control Panel Items\System
>Computer name, domain, and workgroup settings
-
Change settings > Change... > Workgroup > OK
-
Depending on the OS configuration, it may need to be rebooted
-
Depending on the OS configuration, it may need to be rebooted
-
- Ensure traffic between Windows and the Samba Server is allowed on the following ports:
- TCP: 139, 445
-
UDP: 137, 138, 139
-
Ensure Samba Server has been assigned a static IP on the Router
IP '192.168.1.2' mac 'AA:BB:CC:DD:EE:FF' name 'Server'
- Without a static IP, which is where you set the client hostname & client MAC, configured in your Router, the Router has no idea on how to route traffic to the local DNS hostname.
-
Reboot Router once changed to allow for new DHCP pull by Server
- Windows 10 v1709 or greater, ensure SMB Direct is enabled and SMB v1.0 is disabled
-
Control Panel\Programs\Programs and Features
>Turn Windows features on or off
-
Uncheck: SMB 1.0/CIFS File Sharing Support
- SMB 1.0 is not secure and has been actively exploited for >2yrs on devices with SMB v1.0 enabled
- There is no reason to utilize SMB1, as all devices support at least SMB2
- Check: SMB Direct
-
OK (Follow on-screen instructions and Reboot)
-
-
Ensure Samba Server's
smb.conf
contains the following:[global] server min protocol = SMB2 server max protocol = SMB3_11 netbios name = <Samba Server Hostname> workgroup = <Local Domain>
- Ensure
workgroup
Local Domain matches what was set in 1.3.2 (above) - Ensure
server max protocol
is the max of what your Samba Server build supports - Restart Samba to apply changes
- Ensure
-
Add Samba Server to Windows' hosts file
-
C:\Windows\System32\drivers\etc\hosts
# ##::[[--- Windows Host Config ---]]::## #=========================================================== ##----- LAN -----## #=========================================================== # OpenWrt: 192.168.1.1 OpenWrt OpenWrt.Wrt 192.168.1.2 Server Server.Wrt 192.168.1.3 Win10 Win10.Wrt
- 1st Column: Static IP of host
- 2nd Column: Hostname of host
-
3rd Column: Hostname and Local Domain address, where
Wrt
is the Local Domain
-
- Open This PC, navigating to the share in the Address Bar:
\\ServerHostname\ShareName
Troubleshooting:
If this does not resolve your issue:
- Power-off the Windows device, Samba Server, and Router
- Simplest way to ensure DHCP is cleared
- Power-on Router and wait for it to fully boot up (if OEM firmware: wait 120s || all others: 60s)
- Power-on Samba Server and Windows device
Please post a comment if this doesn't work, allowing the answer to be tweaked, or added to, ensuring it works for all with this issue.