lmhosts (samba)

Jiri T. Pelech pes na cesnet.cz
Pondělí Listopad 25 10:31:35 CET 1996


Kdesi v Australii existuje docela pekna stranka o Sambe.

Vytazek z URL
http://samba.canberra.edu.au/pub/samba/docs/smb_serv/html/smb_se-5.html

5.7 How do I construct an lmhosts table?

Documentation for the lmhosts file format is rather hard to find. It is loosely based on the 4.2 BSD hosts format. What is included here if for the reader's convenience and is a compilation from several sources, and does not claim to be complete and/or correct for all possible clients.

On the client side the lmhosts file is used to match server names across remote networks connected by routers or gateways. You can also use the lmhosts file if WINS servers are not available on the network, or on a routed or bridged section. Use of lmhosts files on clients can substantially decrease the broadcast traffic on a network, even if WINS and DNS are running. Clients must have DNS usage enabled to use lmhosts.

Through the use of a well managed lmhosts file propagated from the server, the administrator may easily handle updates to system mapping, and may also keep browser lists reasonably small and appropriate in content to the users. This also allows for routed browsing, even without WINS servers on the subnets.

Useful modifiers in lmhosts for Microsoft Windows clients include:

#PRE

Added after an entry causes that entry to be preloaded into the name cache. By default, entries are not preloaded, but are only parsed after WINS and name query broadcasts fail to resolve a name. #PRE must be appended for entries that also appear in #INCLUDE statements; otherwise, the entry in #INCLUDE is ignored.

#DOM domain

Added after an entry associates that entry with the domain specified by domain. This keyword affects how the Browser and Logon services behave in routed TCP/IP environments. To preload a #DOM entry, you must also add the #PRE keyword to the line.

#INCLUDE filename

Forces the system to seek the given filename and parse it as if it was local. Specifying a Universal Naming Convention (UNC) filename allows you to use a centralized lmhosts file on a server. You may also include different lmhosts files from a server to selected clients. This is very useful for administration, as you may change and control share paths for clients centrally. You must add a mapping for the server before its entry in the #INCLUDE section and also append #PRE to ensure that it is preloaded (otherwise, the #INCLUDE will be ignored).

G

Denotes a broadcast address for a workgroup with a given name. An IP address of 0.0.0.0 will be replaced by our default broadcast address but explicit adresses can also be given. Used when a workgroup spans several subnets or when including names of "external" workgroups

#BEGIN_ALTERNATE

Used to group multiple #INCLUDE statements. Any single successful #INCLUDE statement causes the group to succeed.

#END_ALTERNATE

Used to mark the end of an #INCLUDE grouping.

\0xnn

Support for nonprinting characters in NetBIOS names. A character specified this way has to be the last one in a string of a length 16 characters; the name should be padded with blanks if necessary. Enclose the NetBIOS name in double quotation marks and use \0xnn hexadecimal notation to specify a hexadecimal value for the character. This allows to hide custom applications. Names with non-printing characters will not show up in browsers, but still can be connected to when specified explicitely. However, LAN Manager 1.0 TCP/IP does not recognize the hexadecimal format, so you surrender backward compatibility to old LAN Manager servers if you use this feature.

The following example shows how all of these keywords are used: 
------------------------------------------------------------------------
0.0.0.0         mygroup            G         # defaults to our broadcast
102.54.95.255   mygroup            G         # more of "mygroup"
                                             # on another subnetwork
102.54.94.98    localserv          #PRE
102.54.94.97    trey               #PRE #DOM:networking    #net group's PDC
102.54.94.102   "appname   \0x14"            #special app server
102.54.94.123   popular            #PRE      #source server
#BEGIN_ALTERNATE
#INCLUDE        \\localsrv\public\lmhosts    #adds LMhosts from this server
#INCLUDE        \\trey\public\lmhosts        #adds LMhosts from this server
#END_ALTERNATE
------------------------------------------------------------------------

In the preceding example: 

1.The servers named localsrv and trey are preloaded so that they may be used later in an #INCLUDE statement in a centrally maintained lmhosts file.
2.The server named "appname \0x14" contains a special character after the 15 characters in its name (including blanks), so its name is enclosed in double quotes.
3.The server named popular is preloaded, based on the #PRE keyword.

Jiri Pelech


Další informace o konferenci Linux