Difference between revisions of "OpenWRT WINS with Samba"

2,061 bytes added ,  09:32, 19 August 2021
m
m
Line 33: Line 33:


<nowiki>*</nowiki> This webpage notes that there are various ways to display all of the records: https://superuser.com/questions/1492010/finding-all-samba-shares-in-local-network
<nowiki>*</nowiki> This webpage notes that there are various ways to display all of the records: https://superuser.com/questions/1492010/finding-all-samba-shares-in-local-network
====== Static WINS Entries (not to be confused with LMHOSTS File) ======
First things first: The LMHOSTS file is used ''only'' the local computer / server (IE, the OpenWRT / LinkSys device that is acting as the WINS / NMBD (The component of Samba that equates to WINS) Server).  The LMHOSTS File and its entries are ''not'' used in resolving names to IP Addresses for clients of the WINS Server.  That duty is held by two files: wins.dat and browse.dat.  And no one seems to want anyone to find those files (IE, I dare anyone to find documentation, besides here that notes the location of both of these files.
/tmp/lib/samba/wins.dat (AKA /var/lib/samba/wins.dat)
/tmp/cache/samba/browse.dat (AKA /var/cache/samba/browse.dat)
Here's an interesting statement about the wins.dat file from https://wiki.rockstable.it/Samba: "On Samba the dynamically maintained database is stored persistently across reboots in <code>/var/lib/samba/wins.dat</code>, which is written in regular intervals."  Keep in mind this was not written about OpenWRT.  Does that make a difference?  Yes it does.  Look at the path OpenWRT stores the wins.dat file (Hint: It begins with /tmp, which means it does ''not'' persist across reboots).  Is this compensated for with something in the /etc/init.d/samba4 configuration file?  Nope.  In the /etc/config/samba4 settings?  Nope.  Solution?  Make one up.
In OpenWRT, is it possible to put manual entries in the /var/lib/samba/wins.dat file?  Yes.  Will the entry exist for more than about 30 seconds?  No.  So putting static entries into the wins.dat file is pointless.  That's for the NMBD Service which responds to broadcast requests for a NetBIOS name.
The format of entries in the /var/lib/samba/wins.dat file are from here: https://www.linuxtopia.org/online_books/network_administration_guides/samba_reference_guide/17_NetworkBrowsing_23.html
* "NAME#TYPE" TTL ADDRESS+ FLAGS
** NAME = NetBIOS name
** TYPE = NetBIOS type
** TTL = Time To Live (in seconds)
** ADDRESS+ = One, possibly more addresses for the Computer / Entity
** FLAGS = NetBIOS


======Recommendation for Windows Hosts that are Multihomed (IE, have more than one network interface)======
======Recommendation for Windows Hosts that are Multihomed (IE, have more than one network interface)======
Line 42: Line 62:
=====Other Information=====
=====Other Information=====


* If there is no Windows Domain Controller within a subnet, the following configuration is recommended for the /etc/dhcpd;
*If there is no Windows Domain Controller within a subnet, the following configuration is recommended for the /etc/dhcpd;
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
# This configures Samba to enable WINS support
# This configures Samba to enable WINS support
Line 54: Line 74:
</syntaxhighlight>
</syntaxhighlight>


* The netbios name = |NAME| directive in Services, Network Share, Edit Template Tab in the OpenWRT GUI configures SAMBA with the name defined in the System, System, Hostname Field.
*The netbios name = |NAME| directive in Services, Network Share, Edit Template Tab in the OpenWRT GUI configures SAMBA with the name defined in the System, System, Hostname Field.
*  
*


==== Remaining Items to Document ====
====Remaining Items to Document====


* LMHOSTS
*LMHOSTS
** https://www.samba.org/samba/docs/using_samba/ch07.html
**https://www.samba.org/samba/docs/using_samba/ch07.html


* nss-mdns: A simple service that doesn't seem to exist any longer for OpenWRT (possibly replaced by UMDNS or can be replace by Avahi) that allows a Linux (AKA OpenWRT) device to resolve WINS style host names from an LMHOSTS file (which only resolves names for the local router).
*nss-mdns: A simple service that doesn't seem to exist any longer for OpenWRT (possibly replaced by UMDNS or can be replace by Avahi) that allows a Linux (AKA OpenWRT) device to resolve WINS style host names from an LMHOSTS file (which only resolves names for the local router).
** https://forum.openwrt.org/t/what-happened-to-nss-mdns-package-mdns-local-dns-resolution/25799
**https://forum.openwrt.org/t/what-happened-to-nss-mdns-package-mdns-local-dns-resolution/25799
** https://serverfault.com/questions/272965/how-can-i-make-ubuntu-use-samba-to-resolve-windows-host-names
**https://serverfault.com/questions/272965/how-can-i-make-ubuntu-use-samba-to-resolve-windows-host-names
** https://fedoramagazine.org/find-systems-easily-lan-mdns/
**https://fedoramagazine.org/find-systems-easily-lan-mdns/
* AVAHI
*AVAHI
** https://openwrt.org/docs/guide-user/network/zeroconfig/zeroconf
**https://openwrt.org/docs/guide-user/network/zeroconfig/zeroconf
* UMDNS: An alternative to AVAHI from OpenWRT ( )
*UMDNS: An alternative to AVAHI from OpenWRT ( )
** https://openwrt.org/docs/guide-user/network/zeroconfig/zeroconf
**https://openwrt.org/docs/guide-user/network/zeroconfig/zeroconf
** <br />
**<br />