OpenWRT WINS with Samba: Difference between revisions
Line 57: | Line 57: | ||
**ADDRESS+ = One, possibly more addresses for the Computer / Entity | **ADDRESS+ = One, possibly more addresses for the Computer / Entity | ||
**FLAGS = NetBIOS Flags (from https://www.samba.org/~ab/output/htmldocs/Samba3-HOWTO/NetworkBrowsing.html): The NetBIOS flags may be interpreted as additive hexadecimal values: 00 - Broadcast node registration, 20 - Peer node registration, 40 - Meta node registration, 60 - Hybrid node registration, 02 - Permanent name, 04 - Active name, 80 - Group name. The 'R' indicates this is a registration record. Thus 66R means: Hybrid node active and permanent NetBIOS name. These values may be found in the <code>nameserv.h</code> header file from the Samba source code repository. These are the values for the NB flags. | **FLAGS = NetBIOS Flags (from https://www.samba.org/~ab/output/htmldocs/Samba3-HOWTO/NetworkBrowsing.html): The NetBIOS flags may be interpreted as additive hexadecimal values: 00 - Broadcast node registration, 20 - Peer node registration, 40 - Meta node registration, 60 - Hybrid node registration, 02 - Permanent name, 04 - Active name, 80 - Group name. The 'R' indicates this is a registration record. Thus 66R means: Hybrid node active and permanent NetBIOS name. These values may be found in the <code>nameserv.h</code> header file from the Samba source code repository. These are the values for the NB flags. | ||
***64R = Hybrid Node Registration AND Active Name AND registered | ***64R = Hybrid Node Registration AND Active Name AND registered | ||
Wait! What about the /tmp/lib/samba/wins.tdb file? According to this (even though it refers to Samba 3, it applies to Samba 4): https://www.samba.org/samba/docs/old/Samba3-HOWTO/tdb.html, the wins.tdb file is used for "permanent storage" (IE static WINS entries). Can it be edited (in a useful manner)? No, because it is a binary file, not a text file. How is information input into it? Using the NET command? We'll see. | Wait! What about the /tmp/lib/samba/wins.tdb file? According to this (even though it refers to Samba 3, it applies to Samba 4): https://www.samba.org/samba/docs/old/Samba3-HOWTO/tdb.html, the wins.tdb file is used for "permanent storage" (IE static WINS entries). Can it be edited (in a useful manner)? No, because it is a binary file, not a text file. How is information input into it? Using the NET command? We'll see. | ||
Line 65: | Line 65: | ||
Ahhh! Here's the answer, with the best tip coming from this site: https://samba.samba.narkive.com/UPIyT5mM/samba-as-a-wins-server But alone that isn't enough as the static entries need to be made so they can persist across router reboots. | Ahhh! Here's the answer, with the best tip coming from this site: https://samba.samba.narkive.com/UPIyT5mM/samba-as-a-wins-server But alone that isn't enough as the static entries need to be made so they can persist across router reboots. | ||
* Stop the NMBD Service (Hint: the SMB service starts and stops the NMBD service in OpenWRT): service samba4 stop (assuming Samba 4 is being used, which it should be, but plain samba, AKA Samba 3 should work the same.) | *Stop the NMBD Service (Hint: the SMB service starts and stops the NMBD service in OpenWRT): service samba4 stop (assuming Samba 4 is being used, which it should be, but plain samba, AKA Samba 3 should work the same.) | ||
* Add an entry to the /var/lib/samba/wins.dat file (...remembering that it will not persist across router reboots, see below to solve that issue) | *Add an entry to the /var/lib/samba/wins.dat file (...remembering that it will not persist across router reboots, see below to solve that issue) | ||
* Start the NMBD Service: service samba4 start | *Start the NMBD Service: service samba4 start | ||
* Add the below to the OpenWRT Startup Scripts (via LuCI GUI: System, Startup, Local Startup Tab; | *Add the below to the OpenWRT Startup Scripts (via LuCI GUI: System, Startup, Local Startup Tab; | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
### Adds Static Mapping for WINS from /etc/samba/samba.static | ### Adds Static Mapping for WINS from /etc/samba/samba.static | ||
### Don't forget to put static entries in the above noted file in the correct format | ### Don't forget to put static entries in the above noted file in the correct format | ||
/etc/init.d/samba4 stop | ###### There is no need to stop or start the Samba Service because the OpenWRT StartUp Script (rc.d) has a start position of 95 and the Samba4 Service has a start position of 98, so the SMB service isn't even started when this script runs. The samba4 stop and start lines were put in to emphasize this because according to Samba documentation, the samba service must be stopped to modify the wins.dat file with static entries. | ||
# The file | ###### /etc/init.d/samba4 stop | ||
###### The samba directory and wins.dat file do not exist when this script runs, so create them and make sure the permission are correct (they should be, but make sure with the chmod command). | |||
mkdir /tmp/lib/samba | |||
touch /tmp/lib/samba/wins.dat | touch /tmp/lib/samba/wins.dat | ||
chmod 644 /tmp/lib/samba/wins.dat | chmod 644 /tmp/lib/samba/wins.dat | ||
###### Put any static mappings (that the Microsoft term) for WINS in the samba.static file | |||
cat /etc/samba/samba.static >> /tmp/lib/samba/wins.dat | cat /etc/samba/samba.static >> /tmp/lib/samba/wins.dat | ||
/etc/init.d/samba4 start | ###### /etc/init.d/samba4 start | ||
</syntaxhighlight><br /> | </syntaxhighlight><br /> | ||
======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)====== |