Name Resolution and Server Location
Name resolution is an important building block for Microsoft Networking, as with any network service. After our discussion in Hour 1, "Understanding Networking: The Telephone Analogy," you're probably comfortable with the fact that any network name needs to be resolved to a network addressthat is, when you point your browser to http://www.jotto.com, the name gets resolved via DNS (Domain Name Service) to the network address 22.214.171.124.
The great news is that the latest versions of Microsoft networking do just this: they use DNS as their primary means of name resolution and server location. The bad news is that there are a couple of backward-compatible issues that you will need to understand to effectively troubleshoot. Furthermore, even if you are an old hand at DNS, you'll need to learn a bit more about how Microsoft does it. All the methods of Microsoft name resolution and server location (which in aggregate are called the Windows Locator Service) can be summarized as
NetBIOS standalone (broadcast or static name files)
NetBIOS point-to-point and flat (non-hierarchical) name server (WINS)
Hierarchical name server (DNS)
Let's start by discussing how standalone NetBIOS works, both from name resolution and server lookup ("browse") standpoints, and then we'll be equipped to understand both WINS and DNS.
First of all, what is NetBIOS?
NetBIOS (Network Basic Input/Output System) provides name and session services to the file-sharing and print-sharing programs between two computers. You're using NetBIOS when you share files between two Windows 9x family computers.
NetBIOS handles name services for Microsoft file and print services. It also serves to carry messages pertaining to the creation of workgroups on the network and makes sure that no duplicate workstation names exist within the workgroup or domain.
When a duplicate workstation name does exist, NetBIOS tells you about it in a hurry. For example, when a technician duplicates a known-good hard drive (see Hour 18, "Managing Change: Establishing Consistency and Standards") to a known-bad hard drive and then reboots both stations, he or she immediately sees the following Windows error, which is in fact a NetBIOS error:
Microsoft Networking: The following error occurred while loading protocol number 0. Error 38: The computer name you specified is already in use on the network. To specify a different name, double-click the Network icon in Control Panel.
NetBIOS has queried the network to see if the name exists, and, in fact, it does. Of course, the tech simply goes to the Control Panel, clicks the Identification tab, and changes the PC name to fix this problem.
The question becomes: How does NetBIOS know that the name is in use? Well, when there's a name server in use, NetBIOS simply queries the name server for its own name before announcing itself.
What do you do when you don't have a name server? There are two methods you could use: broadcast and static host tables.
Broadcasting means that each NetBIOS station communicates with the subnet's TCP/IP broadcast address for the purposes of finding out "who else is out here," and announcing itself. It's pretty simple, and works similarly to NetBEUI (a nonroutable protocol that transports NetBIOS), except that it's using TCP/IP. (We'll discuss the good points and bad points of NetBEUI in a little while.)
What about static host tables? First of all, what is a static host table? By definition, a static host table is a file or database that is local to a workstation; it does not look changes up from the network the way that DNS does.
Here's one example of a static host table. As you probably already know, a Windows PC's TCP/IP stack can use a HOSTS table on its hard drive to resolve hostnames to IP addresses. The HOSTS table is used for normal TCP/IP networking (as in Telnet sessions to a host system as well as pings). A HOSTS file looks like this:
192.168.10.5 elmo 192.168.10.5 grover
This means that 192.168.10.5 is the numeric address for elmo, and 192.168.10.6 is the numeric address for grover.
Each Windows PC can also use an LMHOSTS filea different kind of static host tablewhich is formatted much the same as a HOSTS file but used for NetBIOS name resolution. Why? Well, a HOSTS file only specifies a name-to-address mapping; it does not indicate what service is offered by which host.
Contrast this to LMHOSTS, where one can actually specify, "Hey, if you're looking for the main server to logon to, here it is!" For example,
192.168.10.5 elmo 192.168.10.5 grover #DOM:feldmonster
specifies that grover is not only IP address 192.168.10.5, but is also the main server for the domain feldmonster. See the difference? Again, the HOSTS file only specifies name resolution; the LMHOSTS file specifies where services are located; for this reason, the entry is known as a mapping rather than just a resolution.
Historical/trivia note: The LM stands for LAN Manager, which is what Windows networking evolved from.
Both the LMHOSTS and HOSTS files live in the C:\WINDOWS directory in the Windows 9x family; the Windows NT families locate these files in the %SYSTEMROOT%\etc\drivers directory (%SYSTEMROOT% on XP defaults to Windows\System32; NT and 2000's default is WinNT\System32.)
LMHOSTS.SAM is a sample file you can look at to see the file format and so on. I strongly recommend that you not use LMHOSTS files (or HOSTS files) as a normal practice unless you have the smallest network in the world; the tedium of updating many of these files makes you wish you were running after really tough network problems instead.
Although you should consider static host mappings (and static host tables in general) to be a day-to-day no-no, you should know about them for two troubleshooting reasons. First, if there's a name resolution problem with a workstation, you might want to see if somebody has been monkeying around with LMHOSTS at a given client computer. Second, you can play with an LMHOSTS file to rule in or rule out name resolution in a given problem. (For example, say that you get a no domain controller could be located error for the feldmonster domain. If you manually insert the correct IP address in the LMHOSTS fileand it worksyou definitely have a problem with service location between this workstation and the server.)
Whether or not you're using static mappings, it is highly useful to be able to find out what a particular Windows station thinks that current mappings are. That's where the nbtstat tool comes in. The rub here is that you need to know how to translate hexadecimal values into actual usable service information. For example, here's the output from a machine on my home network, using the nbtstat -n command (I have modified the table to include the actual meanings of the hexadecimal numbers):
Name Type Status Meaning ------------------------------------------------------- MONSTER <20> UNIQUE Registered File & Print Server MONSTER <00> UNIQUE Registered Computer name FELDMONSTER <00> GROUP Registered Workgroup name FELDMONSTER <1E> GROUP Registered Backup browser
This might be a little early to discuss this because I haven't covered some of the concepts in the definitions, but it's important to know that nbtstat is usable no matter whether you're using a name server or running standalone with a static host table. One concept that hasn't been covered yet is browsing; but worry not, we'll get to that in the next section.
Ordinarily, the meaning of the hex numbers doesn't appear; but you can get a listing of all NetBIOS hexadecimal numbers from http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarwnet/html/msdn_browse1.asp. You can also retrieve the NetBIOS name table from a given IP address, say, 10.1.2.3, by using the nbtstat -a 10.1.2.3. If you were to do this to an NT 4.0 domain controller, normally, it would look like this (but without my addition of a Meaning column):
Name Type Status Meaning ------------------------------------------------------- SHREK <00> UNIQUE Registered Workstation services FELDMONSTER <00> GROUP Registered Legacy "Lan manager" type domain SHREK <20> UNIQUE Registered File & Print Server FELDMONSTER <1B> UNIQUE Registered Primary Domain Controller FELDMONSTER <1E> GROUP Registered Master Browser, Domain-type SHREK <03> UNIQUE Registered Messenger service INet~Services <1C> GROUP Registered Internet group name IS~SHREK.......<00> UNIQUE Registered FELDMONSTER <1D> UNIQUE Registered ..__MSBROWSE__.<01> GROUP Registered Alias of MasterBrowser for subnet SHREK <01> UNIQUE Registered Real name:MasterBrowser of subnet
What about Windows 2000 servers? Well, here you would be more interested in DNS, which we'll discuss in a little while.
NetBEUI is for networks that don't have TCP/IP; typically small networks or workgroups without the need for Internet access. If you have TCP/IP, skip this unless you like history lessons. Or, if you see NetBEUI in your network configuration and you have TCP/IP, read on to see why you should get rid of NetBEUI.
NetBEUI is a nonroutable protocol that transports NetBIOS. Again, it is only used when TCP/IP is not available. It is simply the way the NetBIOS messages are packaged and delivered to the wire. The plus used to be that you didn't need to have a TCP/IP stack loaded on your PC to be able to do useful networking functions. The downside was that because NetBEUI is very simple, it relies on network broadcasts to get a lot of information across: There aren't any network addresses, so everything is addressed to everyone.
A broadcast (when a network node sends information to all other network nodes on a segment) obviously causes a lot of network traffic. NetBEUI does this so it doesn't have to keep track of all the nodes on the networkif a station doesn't differentiate whom to talk to, there doesn't have to be a facility on the network to keep track of who's currently available on the network.
There are two consequences: First, a name server isn't necessary with NetBEUI (good if you don't have a name server); and second, NetBEUI traffic cannot traverse a router (bad if you have a router and you want your people to be able to share files across it).
Considering that nowadays it's pretty easy to bring up a name server, why does NetBEUI even exist? Well, if you had less than 30 stations, no server, and no Internet connection, NetBEUI was pretty attractive: There was no need to allocate TCP/IP addresses (therefore requiring tracking of static IP numbers or a DHCP server) and no need for a name server. A lot of people used it for this reason. But if NetBEUI is in use on a network nowadays, it is just there because of inertia: most folks now have a server and the associated TCP/IP infrastructure required for TCP/IP operation.
Accordingly, you really shouldn't be using NetBEUI. Broadcasts are the pits; in large enough quantities, they will lead to broadcast storms (that is, one workstation broadcasts, leading other workstations to broadcast). On a large scale, this creates unnecessary network traffic that can wreak havoc on your network. Get rid of it if you can. (Naturally, the same argument goes for TCP/IP workstations without name servers, by the way, because they must broadcast.)
The Windows networking literature refers to browsing as the process of listing all available Windows networking resources, as opposed to when you know a server name and you simply ask for a connection.
When you're using a peer-to-peer network (no server involved), one computer gets arbitrarily designated as browse master; others are designated as backup browsers. Any client computer can get information about network resources, whether the resources are servers, workgroups, NT domains, and so on. For example, when you click your Network Neighborhood icon, the computer list you see is obtained from the browse master of your workgroup or domain. As you can see, browsing is pretty importantif you can't see the resource, you can't use the resource.
The browse master of a workgroup or domain is the machine that's responsible for keeping a list of participating workstations. If the browse master leaves the workgroup, another browser from the backup browser list must take over. If a backup browser erroneously believes that it is in charge, problems spring up. Staying current on service packs usually prevents this type of misbehavior.
The browse master of a domain is always the primary domain controller (PDC). If it's not, you've got a problem. The Browser Monitor on the NT and Win2K resource kits (BROWMON.EXE) can help you check on browser status on a subnet.
Workgroup browsing problems might simply be a typo because no joining is involved when the workstation is set up. It's really easy for the person doing the setup to walk away without verifying browse-ability. I once saw a case in which a user absolutely could not browse others in her workgroup. After checking the network card and cable and finding nothing wrong, we were on the verge of reinstalling Windowswe had tracked the problem down to something about the OS. Before doing this, we checked the Control Panel one last time; this time, we noticed that the workgroup name had a space in front of it. Argh! We removed the space, and suddenly we could see everybody else.
I've also seen a case in which a workgroup was mistyped using a zero rather than the letter O.
Although an NT domain can exist across subnets (that is, via a router), workgroups cannot. Instead, the workgroup exists twice on the two different segmentseach one with its own browse master and browse list. This means that the browse master on network A has no idea what the browse list is for network B. Computers on segment A will not be able to see those on segment B in their network neighborhood, and vice versa.
WINS: The "Flat" NetBIOS Name Server
Windows Internet Naming Service or WINS, was invented to make routable Windows Networking possible. As you'll recall, using TCP/IP in its simplest form (without a name server) means that NetBIOS must use broadcasts or static name tables, both of which are horrible for reasons already outlined.
WINS is the answer to how machines can resolve names without broadcasting and without static name tables. When a client machine is configured to use WINS, instead of broadcasting to register itself and check for duplicate names, it contacts the WINS server. The WINS server keeps track of Windows workgroups, domains, and machine names on a TCP/IP network.
When a machine contacts the WINS server directly to register itself and look up other hostnames and services (such as domain controllers), this is called point-to-point name resolution; machines that resolve names this way are called p-nodes. Broadcast machines, as you might expect, are called b-nodes; machines configured to do both (hybrid) are called h-nodes.
WINS servers are available for Windows NT, UNIX (as part of the Samba package), and Windows 2000. There is no WINS server for workgroups.
WINS has several limitations:
It is flat, rather than hierarchical. In a large organization, this means that it's pretty easy to accidentally duplicate machine names.
Although WINS does have replication options (the capability for two or more servers to share data), in practice, this is fairly annoying to administer because there is no master relationship: each server is peer-to-peer, and equally able to mess up the database.
In a busy and large WINS system, database corruption happens, not infrequently.
Here's some advice about WINS:
If you're using Windows 2000, use DNS instead of WINS.
Use NBTSTAT (built-in) and WINSCHK (available from the Windows resource kits) as good rule in/rule out tools when you suspect problems with WINS servers and/or their databases. Bear in mind that you always want to get multiple perspectives from these tools; that is, point them at several different machines to see "which one of these things is not like the others."
Make sure that your DHCP servers distribute the correct WINS servers to clients! Sounds simple, but in practice, people do forget this.
Don't be shy about deleting the WINS database if you even suspect corruptionremember, the database is dynamic (built by client machines as they connect), so what harm can you really do? It's probably a good idea to do this when things are quiet, though; you'll need to stop the WINS service, delete the database files (typically located in %SystemRoot%\System32\WINS), and then restart WINS. Make sure that your server machines explicitly contact the WINS servers shortly afterward so they can re-register themselves, and be available for clients.
Use few (if any) static mappings. They're annoying to keep up with; you should only use them if a server (for instance, a hardware CDROM server) doesn't support WINS.
Keep it simple! Don't use more WINS servers than you need.
Be consistent! Unless there is a compelling reason not to, make them all replication partners. The last thing you want is an inconsistent database, where server #1 says that a workstation is a certain IP address, and server #2 doesn't know that the workstation exists. A good rule of thumb is, "what you do to one, do to the other." For example, if you delete the WINS database on one machine, make sure to delete it on the otheror the corrupted info will flow back.
Finally, you should know that WINS is "history": it's not something that Microsoft has future plans for. If you must support Windows NT servers and workstations, you need it. But if you don't have to support these, by all means, do not use it; use DNS instead.
DNS: Hierarchical Naming and Service Location
As we'll discuss in Hour 19, DNS is capable of serving up more than just name-to-ip-address translations. DNS can host many types of database records (standard ones include NS, or name server records, and MX, or mail exchanger records), and Microsoft's latest iteration of its networking protocol takes advantage of this by ditching the old NetBIOS and hosting both naming services and service locations in the DNS.
Nothing clears the air like a good example, so let's take a look at what grover, the Primary Domain Controller for an Active Directory domain, would look like if DNS was being used as the resolution mechanism for Windows networking (as is the default behavior for a Windows 2000 network). Using the standard DNS tool, nslookup, to find the primary domain controller, you might type: nslookup _ldap._tcp.dc._msdcs. feldmonster.com, producing this output:
Server: grover.feldmonster.com Address: 10.1.62.2 _ldap._tcp.dc._msdcs.feldmonster.com SRV service location: priority = 0 weight = 100 port = 389 svr hostname = rover.feldmonster.com grover.feldmonster.com internet address = 10.1.62.2
Don't worry too much about the convoluted format of the DNS record; the important thing to understand is that certain types of services have certain types of lookups.
I highly recommend that you read one particular Microsoft tech note; it covers how to integrate a Windows 2000 domain's name resolution into an existing DNS system. I don't recommend actually doing thisto avoid problems, it's really best to use 100% Microsoft DNSbut it is interesting and instructive to see how traditional DNS and Microsoft DNS mesh. Here's the URL: Integrating Your Active Directory Namespace Into an Existing DNS Infrastructure With Name Overlap.
Again, understand that DNS is used as a name resolution and service location mechanism only. DNS does not perform username and password authentication: That is done by the domain controller, not the DNS servers.