Samba related question.

Andrew W. Gaunt quantum at lucent.com
Thu Feb 12 06:21:11 EST 2004


Yes, it is ugly, another reson to try and make everything use DNS
for name resolotion. There are ways to convice the windows PCs to
"put more weight" on DNS for name resolution via the registry.
Here's what we have used (of course the DNS infrastructure is set
up first):

Win95
------------------------------------------------------------------
REGEDIT4

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP]
"LMHostfile"="c:\\windows\\lmhosts"
"EnableDNS"="1"

WinNT4
-------------------------------------------------------------------
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\NetBT\Parameters]
"EnableDNS"=dword:00000001

Most of our PCs are running Win2K or greater (not better ;-) 
which is more easily convinced to use DNS. I believe Win98 has
a 'check box' in the network settings you can set to make it
use DNS for netbios name resolution. I haven't been in that
mire for while so my recollection is clouded.


We put these "registry fixes" on a public samba share (.reg files) 
for PC users. They simply click on them to install. The files are attached to this message.


-- 
____    __
 | 0|___||.  Andrew Gaunt - Computing Development Environment
_| _| : : }  Lucent Intranet: http://mvcde.inse.lucent.com/~quantum
 -(O)-==-o\  Internet: http://www.gaunt.org



bscott at ntisys.com wrote:

>On Wed, 11 Feb 2004, at 11:31am, k1vp at grizzy.com wrote:
>
>>My question relates to getting the Windows boxes to resolve the linux box
>>by name.
>>
>
>  Ahhh.  SMB name resolution.  Never will you find a more retched hive of 
>scum and kludges.
>
>  First, it depends on the version of Windows.  Win 95, 98, ME, and NT 4.0
>all support NetBIOS only.  Windows 2000 and XP add support for DNS, and have
>the option to disable NetBIOS.  (95/98/ME/NT4 will appear to use DNS for SMB
>name resolution, but it won't work right.)  Samba only supports NetBIOS.  
>(I think Samba 3.0 might support SMB w/out NetBIOS, but I'm not sure.)
>
>  NetBIOS is one of the worst ideas, ever.  It can resolve names by either
>local broadcast or by using a WINS server.  Broadcast means just that: A box
>sends a packet to every computer on the local network, and the right one is
>expected to respond.  We hope.  WINS is kinda like DNS for NetBIOS, except
>it (1) sucks and (2) clients automatically register their names.
>
>  There's also the NetBIOS concept of "browse lists".  A computer on the
>local network (the "local master browser") is responsible for keeping a list
>of known names.  When a NetBIOS node starts, it sends a broadcast "here I
>am" packet.  The LMB listens for those.  Then, when someone else wants to
>find the list of names, it broadcasts to find the LMB, and then asks the
>LMB.
>
>  How does the LMB get chosen?  Well, when a NetBIOS node comes online, it
>broadcasts to find the LMB.  If it doesn't get an answer, it nominates
>itself to be the LMB.  If it does get an answer, then it tries to decide if
>it thinks it should be the LMB instead, and if so, holds an "election" with
>all the other potential LMBs on the LAN.  (I'm pretty sure the actual
>process is even uglier then this, but this is close enough.)
>
>  Oh, and NetBIOS names have to be... 14 characters or less, I think.  You 
>can try for longer, but Strange Things Can Happen.
>
>  Anyhow, the following lines in /etc/samba/smb.conf are relevant:
>
>	workgroup = FOO
>
>That says we're a member of workgroup "FOO".  To keep things sane, everyone
>should be a member of the same workgroup.
>
>	netbios name = BAR
>
>That says our own NetBIOS "computer" name is "BAR".  This defaults to 
>"hostname -s", but if you're having trouble, you might want to set this 
>manually.
>
>	name resolve order = lmhosts wins bcast host
>
>That controls how Samba resolves names (not how other nodes do).  "lmhosts" 
>is kinda like /etc/hosts, but with extra crap for NetBIOS.  "bcast" is 
>broadcast.  "host" means the host OS (i.e., Linux), and means things like 
>DNS and /etc/hosts.  Sometimes, it is a good idea to remove "host", as it 
>can complicate things, and MS-Windows generally doesn't use these mechanisms 
>in the same way Samba does.
>
>	local master = yes
>	os level = 90
>	domain master = yes 
>	preferred master = yes
>	domain logons = yes
>
>The above magic will make Linux win almost any browser election.  This can 
>be useful, as Samba is often better at SMB then Windows is -- in particular, 
>the diagnostics are much better.
>
>  	wins support = yes
>
>If "yes", Samba will be a WINS server, and use itself for WINS name 
>resolution.  If "no", Samba will not be a WINS server.
>
>	wins server = 12.23.34.45
>
>Sets the IP address of your WINS server, if you have one.  Do not set this 
>if using "wins support = yes".
>
>
>>... any local machine can ping the linux box by
>>using the assigned IP, but cannot ping it by name.
>>
>
>  Try this command from Linux:
>
>	nmblookup -A foo
>
>where "foo" is the complete IP address of a Windoze machine.  This should 
>list the NetBIOS names the Windoze box is using.  If this fails, 
>SMB-over-NetBIOS-over-IP is not working, and neither will Samba.
>
>  Try this command from Windoze:
>
>	nbtstat -A bar
>
>where "bar" is the complete IP address of the Linux machine.  If this fails, 
>then Samba is not talking to Windows right.
>
>  Next, try this on Linux:
>
>	nmblookup ding
>
>where "ding" is the name of a Windoze machine.  That should attempt to 
>locate the NetBIOS name in question via the same mechanisms that smbd (the 
>server component of Samba) would use.
>
>  Try this on Winzoe:
>
>	nbtstat -a dong
>
>where "dong" is the name of the Linux box.  This will test if Windoze can 
>resolve the NetBIOS name of your Samba.
>
>  If you could resolve a Windows name from Linux, try doing this on Linux:
>
>	smbclient -L //ding
>
>That will list SMB information available on the Windoze box.  If this fails
>when name lookup works, you might have an authentication or protocol
>configuration issue.
>
>  You can also try
>
>	smbclient -I foo -L //ding
>
>which gives "smbclient" the IP address to connect to, skipping name 
>resolution entirely.
>
>  On the Windoze side of things, try
>
>	net view \\bar
>
>and
>
>	net view \\dong
>
>which do similar things in the Windoze world.
>
>  If name resolution appears to be wonky, try:
>
>  - Make the Linux box a WINS server, and have all your Windoze boxen
>    use it as the WINS server
>  - Turn off DHCP on the router and turn it on on Linux.  Use Linux
>    to set the WINS server ("netbios-name-servers" option).  Some
>    SOHO routers have really broken DHCP implementations.
>
>  If all else fails, try increase the "debug level" or "log level" in Samba,
>restarting Samba, and looking at the Samba logs in /var/log/samba/.
>
>  Are we sufficiently disgusted yet?
>
>


-------------- next part --------------
REGEDIT4

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP]
"LMHostfile"="c:\\windows\\lmhosts"
"EnableDNS"="1"

-------------- next part --------------
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\NetBT\Parameters]
"EnableDNS"=dword:00000001


More information about the gnhlug-discuss mailing list