Page 1 of 1

ROOter/OpenWRT Samba Cross-Platform Setup with a WINS Server

Posted: Mon Apr 13, 2020 8:13 pm
by bnhf2
I posted this on the ROOter forum too, but given the single thread nature there, tutorials tend to get lost in the clutter. So, starting with this post -- I'm going to post guides here too for some additional staying power. :-)

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:
screenshot-192.168.100.1-2020.04.13-15_22_15.png
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
You'll also need to comment out the "local master = no" that you'll see earlier in the config by putting a "#" in front of it. The end result should look like this:

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
Save your changes and head on over to Network – Interfaces – LAN – Edit – DHCP Server – Advanced Settings – DHCP Options to setup advertising of your new WINS server to clients on the LAN.

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]
and if you'd like to start advertising a Pi-hole server, or other DNS servers, add a line like this:

Code: Select all

6,[IP of your primary DNS server here],[IP of your secondary (backup) DNS server here]
The end result looks like this in OMR, and very similar in ROOter:
screenshot-192.168.100.1-2020.04.13-15_58_02.png
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:
Screenshot (6).png
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/
screenshot-nimbus-capture-2020.04.13-16_40_39.png

Re: ROOter/OpenWRT Samba Cross-Platform Setup with a WINS Server

Posted: Wed May 12, 2021 10:49 am
by DonJuane
Regarding the Rooter gang, I have asked those guys repeatedly why they won't covert from that old Linux mailing list stile to a modern BBB like here and the best reason they could offer was "this one is comfortable". You pretty much have to have a memory like a Google data center, the patience of Jobe and a personal assistant filtering the data in order to use it. But it's all they are willing to provide at the moment, so we have to deal with it until something changes.

Still, thanks for this! I setup a raspberry pi Samba server through OMV (OpenMediaVault) and I am guessing that this WINS has to be on the same server as Samba? It might even be a part of OMV now as I haven't had the time to get too deep into OMV once I got a simple share of the root of the drive set up. I know I have difficulty accessing from my smart phone but mostly I access the share from a Windows remembered file share (net use x: \\192.168.x.1\ShareName) and on a Firestick via Kodi and Kodi remembers via a smb:\\raspberypi\Videos share access. But the WINS would be a nice upgrade and maybe make it easier for other devices to access. The only reason I did not install Samba on my router is I have a number of external routers, each with a specific phone company SIM and modem along with a Rooter router inside several waterproof enclosures next to antennas pointed at respective towers, so I have to have the server inside "in the dry". Still this is very kind of you to create and share the narrative.