If your network consists of a mix of different operating systems, and includes Windows, you've probably done battle with Samba at one time or another. Left to its own devices Samba is a discovery protocol, which in a mixed OS environment means frequent re-scanning of the LAN when using a file explorer to see your shares.
Making your ROOter, or other OpenWRT-based router, a WINS server significantly speeds up that process. It's easy to do with ROOter, and I'm happy with the results on my network, so thought I'd share the specifics here.
ROOter already comes with Samba installed (except on older memory-limited units), so that part is covered. My primary router is OpenMPTCProuter based, so I needed to install samba36-server and luci-app-samba:
Next order of business is to make your router a WINS server, so that it'll keep track of all available Samba shares — rather than relying on exclusively on discovery. You'll need to add the following to the [Global] section of the smb.conf file. This can be done through the LuCI GUI by navigating to Services – Network Shares – Samba – Edit Template, and adding the following lines to the end of the [global] section:
Code: Select all
domain master = yes
local master = yes
name resolve order = wins lmhosts hosts bcast
os level = 99
preferred master = yes
wins support = yes
Code: Select all
[global]
netbios name = |NAME|
display charset = |CHARSET|
interfaces = |INTERFACES|
server string = |DESCRIPTION|
unix charset = |CHARSET|
workgroup = |WORKGROUP|
bind interfaces only = yes
deadtime = 30
enable core files = no
invalid users = root
# local master = no
map to guest = Bad User
max protocol = SMB2
min receivefile size = 16384
null passwords = yes
passdb backend = smbpasswd
security = user
smb passwd file = /etc/samba/smbpasswd
use sendfile = yes
# OpenWRT Samba User Guide WINS Settings
domain master = yes
local master = yes
name resolve order = wins lmhosts hosts bcast
os level = 99
preferred master = yes
wins support = yes
If you'd like to off-load DNS duties from your router, this is also the place to advertise the DNS servers you'd like your LAN clients to use rather than having DNS queries sent to your primary router to be relayed elsewhere. I'm using an on-LAN Pi-hole server, so I've already been advertising its address to my LAN clients when they get their DHCP address. Now, they'll get the IP of the WINS server at that time too:
Under DHCP-Options, use this structure to advertise your WINS server:
Code: Select all
44,[IP of your WINS server here]
Code: Select all
6,[IP of your primary DNS server here],[IP of your secondary (backup) DNS server here]
The surest way of having these changes take effect immediately is to do a network-wide reboot, by first powering everything down. And then, by bringing your router back online first, followed by your DNS server (if you're using Pi-hole) and then everything else based on other dependencies that are specific to your setup.
Opening Windows Explorer, you should notice a significant speed increase, when clicking on the Network section, for Samba shares to appear:
If you have other problems with Samba, I'd recommend fixing them first before adding a WINS server. There's a Samba scanning tool available as part of the NetScanTools Demo package which will help you identify issues related to what versions of Samba are supported on each of your samba shares. As you can see in the attached, every system on my LAN supports Samba v2.02, giving me a common protocol:
https://www.netscantools.com/