|
Samba and protocols
IntroductionThis page is another sequel to the original Samba page, and provides some information about setting up Windows local networks to run via NetBIOS over TCP/IP. It is based on Windows 95, Windows NT, and Windows 2000 running on the workstations. It was written after I experienced considerable difficulties getting Windows 2000 to talk to Samba on the Linux servers. So what comes below is my solution - there are probably other ways of achieving the same result.
Workgroups for WindowsThe protocols used by Microsoft to achieve peer to peer networking between Windows based workstations has evolved as the versions of the Windows operating systems have evolved. Windows 95 and Windows NT by default both provide a choice of two protocols for use in workgroups - these are NetBEUI and IPX/SPX. NetBEUI is a very simple protocol that requires virtually no configuration - it just works. However it is limited in what it can do - the fact that it cannot be routed is the biggest problem with it. The alternative protocol, IPX/SPX is a fully routable protocol, and was also used by Novell as the default protocol for Netware 4 servers. In Windows networks, sitting above one or other of these two protocols is a software layer that roughly corresponds to the Session layer of the OSI seven layer model - it is known as NetBIOS. NetBIOS is often referred to as a protocol - this is wrong - it is actually a service, that removes the requirement for the application layer to know anything about the network. NetBIOS does this job on behalf of the application layer. So a Windows network can be set up so that NetBIOS runs over NetBEUI, or set up so that NetBIOS sits over IPX/SPX. When Windows 2000 came along, things changed. Microsoft introduced a new form of networking for Windows 2000 workstations - based on TCP/IP. So Windows 2000 machines could talk to each other using only TCP/IP. However in order to provide backward compatability with previous versions of Windows networks, Windows 2000 also provides the ability to communicate via NetBIOS over NetBEUI, or over IPX/SPX.
So where does Samba fit in ?Now it gets interesting - because Samba uses NetBIOS over TCP/IP as its communication system. Although it seems that now there is quite an incompatability between these systems, there is a very easy solution - run everything on NetBIOS over TCP/IP. All these versions of Windows will work fine in this way, and they can be set up to do it as follows.
For Windows 95
For Windows NT
For Windows 2000
Having done all that, you now have a Windows network running via NetBIOS over TCP/IP, and which can include a Linux network server running Samba. And all three versions of Windows as well as Linux are talking to each other.
Speeding things upYou may find that when using My Network Places in Windows 2000 to browse onto the Linux server, that things are a bit slow. Or very slow. This appears to be that when 2000 is going for a search, it first of all tries to use its new TCP/IP based network system, and if that fails, it tries using NetBIOS over TCP/IP. There are some things you can do to speed up the NetBIOS process. To see how they work, it is useful to look at how the NetBIOS connection process works. The following sequence is, I believe, the default sequence of events for a connection via NetBIOS :-
So the obvious place to start is with the lmhosts cache, which is a section of memory which reads the lmhosts file at boot up time, and remembers specific parts of it. Which parts ? Those entries which have #pre after them. So an lmhosts file could look like
The lmhosts file is located in C:\winnt\system32\drivers\etc\ In that ...\etc\ folder there is a sample lmhosts file, called "lmhosts.sam" When Windows 2000 boots up, it reads the lmhosts file, and those entries which have the #pre after them are stored in the lmhosts cache. It is better to have only those entries that are going to be frequently used by Windows 2000 in the lmhosts cache, because you don`t want to fill up your memory with little used data. The results from doing this were disappointing, there was very little increase in speed. So what next - after some more experimentation, I obtained considerable increase in speed by using fully qualified host names in the lmhosts file. So it now looks like :-
This provides a very worthwhile improvement. However I continued to dig and experiment, and eventually found that things began to really take off if I used the hosts file. The hosts file is in the same folder as the lmhosts file, ie, in C:\winnt\system32\drivers\etc\ The hosts file which is provided by default is active, ie Windows 2000 is already using it - most of it is defined as comments by the use of the # at the beginning of each line. However the last line
is not commented out, and is the loopback lookup, so don`t destroy it. The hosts file has different rules from the lmhosts file, and one of the things you can do is to have multiple names against the same ip address. This allows Windows 2000 to do lookups on local names, rather than requiring fully qualified names. So a typical hosts file could be :-
So why does this use of the hosts file provide such a big difference in speed - according to the sequence shown above, it is one of the last places that 2000 looks for a lookup. The only answer that I can come up with is that even though you trying to use NetBIOS, Windows 2000 starts the process by going down the TCP/IP road, rather than down the NetBIOS road. For the TCP/IP road, the sequence of events is, I believe,
So although both sequences look in the same places, they do it in a different order. And in this sequence, the hosts file is the first place that 2000 looks.
Some trivia ....The hosts file and the DNS server map ip addresses to host names, whereas the lmhosts file and WINS server map ip addresses to NetBIOS names. A host name can be any length, whereas a NetBios name is always 16 characters long. In most of the world, a host name might be the same as the NetBIOS name, but in the Microsoft world, they are always different. In the Microsoft world, a NetBIOS name is still sixteen characters long, but the sixteenth character is an identifier. So the actual name part is only fifteen characters long. This therefore raises a question - if the lmhosts file is supposed to contain 16 character NetBIOS names, why does 2000 like having fully qualified host names in it ?
Working within Novell Netware environmentsIf the workstations within the Windows workgroup are also working within a Novell Netware environment, then there are some other points worth noting. Firstly, if the workstation is running the Microsoft Client for Netware networks, then you cannot remove IPX/SPX. IPX/SPX is the only protocol that the Microsoft Client for Netware networks can use. If the workstation is running an up to date Novell client, then this is not a problem, as the Novell client will work quite happily on TCP/IP. If you want to log on to Netware 4 servers, then again, you cannot remove IPX/SPX. Although you can see a Netware 4 server through TCP/IP, you cannot log on to it using TCP/IP. You can use the installation process of a current Novell client to remove IPX/SPX from a workstation - choose the "Custom" installation procedure, and tick the boxes for "IP only", and for "Remove IPX".
A word about securityIt is worth noting that by running NetBIOS over TCP/IP on a workstation, you are potentially allowing other workstations to see into the workstation. Make sure that external workstations can`t see the file system or data they should not be seeing, and don`t have the rights to modify things.
© 2002 Ron Turner Return to the Linux index page
|
|