Discover the Workgroup s Master Browsers


Discover the Workgroup's Master Browsers

nmblookup -M [Master Browser]
nmblookup -S [NetBIOS name]
nmblookup -A [IP address]

A Samba server actually uses two daemons: smbd, which makes the shares available, and nmbd, which maps the NetBIOS names that identify machines using SMB to their IP addresses, thus making it possible to find and browse SMB shares. You're going to focus for now on commands that communicate with nmbd, used to gain some overall information about the Windows workgroup you're querying.

Note

The following examples assume you're using a Windows workgroup, and not a domain. A workgroup is essentially a small group of machines that choose to identify themselves as belonging together by self-identifying as members of the workgroup. A domain uses a central serveror several servers in a large networkto authenticate computers and users who want to join the network. Domains are large, hairy, complicated beasts, and you're best referred to the books referenced in this chapter's introduction if you want to learn more about them.


In a Windows workgroup, you need a machine that keeps track of the other members of the workgroupwhat their SMB names and IP addresses are, for instance. That machine is known as the Master Browser. But which computer in a workgroup is the Master? The one that is elected, based on the operating system it's running. The latest and greatest OS always wins, so XP will always beat 2000, which will always beat 98.

When setting up a Samba server, however, it's possible to configure things so the server always stays out of any such election, letting other machines duke it out, or set things up so that the server always wins any election. You could go ahead and start connecting to Samba shares if you knew about them, but it helps to know where your Master Browsers are in case you have any issues.

To query your network for a Master Browser, run nmblookup with the -M (or --master-browser) option, followed by a - at the end, which basically means "find me a Master Browser." The problem is that you can't use a - on the command line, or the shell thinks it's the start of an option. So you need to preface it with -- first, which tells the shell that the following - is in fact a -, and not part of an option.

$ nmblookup -M -- - querying __MSBROWSE__ on 192.168.1.255 192.168.1.151 __MSBROWSE__<01> 192.168.1.104 __MSBROWSE__<01> 


This isn't good. In your case, you appear to have two Master Browsers on one network, which can be a real problem because different Masters might know about different machines at different times, causing mass confusion to users. One minute a user can get to a machine, and the next it's gone. Why? Because one Master knows about the machine, but the other doesn't. Try explaining that to Bob in Accounting. Yipes.

To get more information about the Master, use nmblookup with the -S (or --status) option, which returns the SMB names the host uses.

$ nmblookup -S 192.168.1.151 querying 192.168.1.151 on 192.168.1.255 name_query failed to find name 192.168.1.151 


That didn't work because -S expects a NetBIOS name instead of an IP address. Unfortunately, you don't know the machine's NetBIOS name, only its IP address. Actually, that's not a problem. You simply add the -A (or --lookup-by-ip) option, which tells nmblookup that you're giving it an IP address instead of a NetBIOS name.

$ nmblookup -SA 192.168.1.151 Looking up status of 192.168.1.151         JANSMAC         <00> -               B <ACTIVE>         JANSMAC         <03> -               B <ACTIVE>         JANSMAC         <20> -               B <ACTIVE>         ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>         MILTON          <00> - <GROUP> B <ACTIVE>         MILTON          <1d> -         B <ACTIVE>         MILTON          <1e> - <GROUP> B <ACTIVE>         MAC Address = 00-00-00-00-00-00 


Now you know that the machine at 192.168.1.151 identifies itself as JANSMAC (it must be a Mac OS box) and is the Master for the MILTON workgroup. What about the other IP address?

$ nmblookup -SA 192.168.1.104 Looking up status of 192.168.1.104         ELIOT           <00> -         B <ACTIVE>         ELIOT           <03> -         B <ACTIVE>         ELIOT           <20> -         B <ACTIVE>         ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE>         TURING          <00> - <GROUP> B <ACTIVE>         TURING          <1d> -         B <ACTIVE>         TURING          <1e> - <GROUP> B <ACTIVE>         MAC Address = 00-00-00-00-00-00 


The computer found at 192.168.1.104 has a NetBIOS name of ELIOT, and is the Master for the TURING workgroup. So actually you have nothing to worry about, as the two machines are each a Master for a separate Workgroup. Machines that self-identify as members of MILTON look to JANSMAC for information, while those that consider themselves part of TURING use ELIOT for the same purpose.

Note

For more information about what the output in these examples means, see http://support.microsoft.com/kb/q163409/ in Microsoft's Knowledge Base.




Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net