Tuesday, August 26, 2014

samba & static wins entries

yes. you need to think about this from time to time.

 Static WINS Entries  
   
Adding static entries to your Samba WINS server is actually fairly easy. All you have to do is add a 
line to wins.dat, typically located in /usr/local/samba/var/locks or /var/run/samba.  
   
Entries in wins.dat take the form of:  
   
 "NAME#TYPE" TTL ADDRESS+ FLAGS  
   
where NAME is the NetBIOS name, TYPE is the NetBIOS type, TTL is the time-to-live as an absolute 
time in seconds, ADDRESS+ is one or more addresses corresponding to the registration, and FLAGS 
are the NetBIOS flags for the registration.  
   
A change that has been made to the wins.dat will not take effect until nmbd has been restarted. 
It should be noted that since the wins.dat file changes dynamically, nmbd should be stopped before editing 
this file. Do not forget to restart nmbd when this file has been edited.  
   
A typical dynamic entry looks like this:  
   
 "MADMAN#03" 1155298378 192.168.1.2 66R  
   
To make a NetBIOS name static (permanent), simply set the TTL to 0, like this:  
   
 "MADMAN#03" 0 192.168.1.2 66R  
   
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 
nameserv.h header file from the Samba source code repository. These are the values for the NB flags.   
   
   
 nameserv.h  
   
    92 /* The wins flags. Looks like the nbflags ! */  
    93 #define WINS_UNIQUE     0x00 /* Unique record */  
    94 #define WINS_NGROUP     0x01 /* Normal Group eg: 1B */  
    95 #define WINS_SGROUP     0x02 /* Special Group eg: 1C */  
    96 #define WINS_MHOMED     0x03 /* MultiHomed */  
    97   
    98 #define WINS_ACTIVE     0x00 /* active record */  
    99 #define WINS_RELEASED     0x04 /* released record */  
   100 #define WINS_TOMBSTONED 0x08 /* tombstoned record */  
   101 #define WINS_DELETED     0x0C /* deleted record */  
   102   
   103 #define WINS_STATE_MASK     0x0C  
   104   
   105 #define WINS_LOCAL     0x00 /* local record */  
   106 #define WINS_REMOTE     0x10 /* remote record */  
   107   
   108 #define WINS_BNODE     0x00 /* Broadcast node */  
   109 #define WINS_PNODE     0x20 /* PtP node */  
   110 #define WINS_MNODE     0x40 /* Mixed node */  
   111 #define WINS_HNODE     0x60 /* Hybrid node */  
   112   
   113 #define WINS_NONSTATIC     0x00 /* dynamic record */  
   114 #define WINS_STATIC     0x80 /* static record */  

No comments: