TCP/IP Troubleshooting

Previous Topic Next Topic

Nbtstat

Nbtstat is designed to help troubleshoot NetBIOS name resolution problems. When a network is functioning normally, NetBIOS over TCP/IP (NetBT) resolves NetBIOS names to IP addresses. It does this through several options for NetBIOS name resolution, including local cache lookup, WINS server query, broadcast, LMHOSTS lookup, Hosts lookup, and DNS server query.

The nbtstat command removes and corrects preloaded entries using a number of case-sensitive switches. The nbtstat -a <name> command performs a NetBIOS adapter status command on the computer name specified by <name>. The adapter status command returns the local NetBIOS name table for that computer as well as the MAC address of the adapter card. The nbtstat -A <IP address> command performs the same function using a target IP address rather than a name.

The nbtstat -c option shows the contents of the NetBIOS name cache, which contains NetBIOS name-to-IP address mappings.

nbtstat -n displays the names that have been registered locally on the system by NetBIOS applications such as the server and redirector.

The nbtstat -r command displays the count of all NetBIOS names resolved by broadcast and by querying a WINS server. The nbtstat -R command purges the name cache and reloads all #PRE entries from the LMHOSTS file. #PRE entries are the LMHOSTS name entries that are preloaded into the cache. For more information about the LMHOSTS file, see the appendix "LMHOSTS Files" in this book.

Nbtstat -RR sends name release packets to the WINS server and starts a refresh, thus re-registering all names with the name server without having to reboot. This is a new option in Windows NT 4.0 with Service Pack 4 as well as in Windows 2000.

You can use nbtstat -S to list the current NetBIOS sessions and their status, including statistics. Sample output looks like this:

C:\>nbtstat -S


Local Area Connection:

Node IpAddress: [172.16.0.142] Scope Id: []


NetBIOS Connection Table


Local Name State In/Out Remote Host Input Output

------------------------------------------------------------------

TESTPC1 <00> Connected Out 172.16.210.25 6MB 5MB

TESTPC1 <00> Connected Out 172.16.3.1 108KB 116KB

TESTPC1 <00> Connected Out 172.16.3.20 299KB 19KB

TESTPC1 <00> Connected Out 172.16.3.4 324KB 19KB

TESTPC1 <03> Listening


Finally, nbtstat -s provides a similar set of session listings, but provides the remote computer names, rather than their IP addresses.


note-icon

Note

The options for the Nbtstat command are case sensitive.

The Nbtstat switches are listed in Table 3.4.

Table 3.4 Nbtstat Switches

Switch Name Function
-a <name> adapter status Returns the NetBIOS name table and MAC address of the address card for the computer name specified.
-A <IP address> Adapter status Lists the same information as -a when given the target's IP address.
-c cache Lists the contents of the NetBIOS name cache.
[Number] Interval Typing a numerical value tells Nbtstat to redisplay selected statistics each interval seconds, pausing between each display. Press Ctrl+C to stop redisplaying statistics.
-n names Displays the names registered locally by NetBIOS applications such as the server and redirector.
-r resolved Displays a count of all names resolved by broadcast or WINS server.
-R Reload Purges the name cache and reloads all #PRE entries from LMHOSTS.
-RR ReleaseRefresh Releases and reregisters all names with the name server.
-s sessions Lists the NetBIOS sessions table converting destination IP addresses to computer NetBIOS names.
-S Sessions Lists the current NetBIOS sessions and their status, with the IP address.
/? Help Displays this list.

© 1985-2000 Microsoft Corporation. All rights reserved.