使用 nbtstat 解决 NetBIOS 名称问题
TCP/IP 上的 NetBIOS (NetBT) 将 NetBIOS 名称解析成 IP 地址。TCP/IP 为 NetBIOS 名称解析提供了很多选项,包括本地缓存搜索、WINS 服务器查询、广播、DNS 服务器查询以及 Lmhosts 和主机文件搜索。
Nbtstat 是解决 NetBIOS 名称解析问题的有用工具。可以使用nbtstat 命令删除或更正预加载的项目:
nbtstat -n 显示由服务器或重定向器之类的程序在系统上本地注册的名称。
nbtstat -c 显示 NetBIOS 名称缓存,包含其他计算机的名称对地址映射。
nbtstat -R 清除名称缓存,然后从 Lmhosts 文件重新加载。
nbtstat -RR 释放在 WINS 服务器上注册的 NetBIOS 名称,然后刷新它们的注册。
nbtstat -a name 对 name 指定的计算机执行 NetBIOS 适配器状态命令。适配器状态命令将返回计算机的本地 NetBIOS 名称表,以及适配器的媒体访问控制地址。
nbtstat -S 列出当前的 NetBIOS 会话及其状态(包括统计),如下例所示:
NetBIOS connection table
Local name State In/out Remote Host Input Output
------------------------------------------------------------------
CORP1 <00> Connected Out CORPSUP1<20> 6MB 5MB
CORP1 <00> Connected Out CORPPRINT<20> 108KB 116KB
CORP1 <00> Connected Out CORPSRC1<20> 299KB 19KB
CORP1 <00> Connected Out CORPEMAIL1<20> 324KB 19KB
CORP1 <03> Listening
使用 netstat 显示连接统计
可以使用 netstat 命令显示协议统计信息和当前的 TCP/IP 连接。netstat -a 命令将显示所有连接,而 netstat -r 显示路由表和活动连接。netstat -e 命令将显示Ethernet 统计信息,而 netstat -s 显示每个协议的统计信息。如果使用 netstat -n,则不能将地址和端口号转换成名称。下面是 netstat 的输出示例:
C:\>netstat -e
Interface Statistics
Received Sent
Bytes 3995837940 47224622
Unicast packets 120099 131015
Non-unicast packets 7579544 3823
Discards 0 0
Errors 0 0
Unknown protocols 363054211
C:\>netstat -a
Active Connections
Proto Local Address Foreign Address State
TCP CORP1:1572 172.16.48.10:nbsession ESTABLISHED
TCP CORP1:1589 172.16.48.10:nbsession ESTABLISHED
TCP CORP1:1606 172.16.105.245:nbsession ESTABLISHED
TCP CORP1:1632 172.16.48.213:nbsession ESTABLISHED
TCP CORP1:1659 172.16.48.169:nbsession ESTABLISHED
TCP CORP1:1714 172.16.48.203:nbsession ESTABLISHED
TCP CORP1:1719 172.16.48.36:nbsession ESTABLISHED
TCP CORP1:1241 172.16.48.101:nbsession ESTABLISHED
UDP CORP1:1025 *:*
UDP CORP1:snmp *:*
UDP CORP1:nbname *:*
UDP CORP1:nbdatagram *:*
UDP CORP1:nbname *:*
UDP CORP1:nbdatagram *:*
C:\>netstat -s
IP Statistics
Packets Received = 5378528
Received Header Errors = 738854
Received Address Errors = 23150
Datagrams Forwarded = 0
Unknown Protocols Received = 0
Received Packets Discarded = 0
Received Packets Delivered = 4616524
Output Requests = 132702
Routing Discards = 157
Discarded Output Packets = 0
Output Packet No Route = 0
Reassembly Required = 0
Reassembly Successful = 0
Reassembly Failures =
Datagrams Successfully Fragmented = 0
Datagrams Failing Fragmentation = 0
Fragments Created = 0
ICMP Statistics
Received Sent
Messages 693 4
Errors 0 0
Destination Unreachable 685 0
Time Exceeded 0 0
Parameter Problems 0 0
Source Quenches 0 0
Redirects 0 0
Echoes 4 0
Echo Replies 0 4
Timestamps 0 0
Timestamp Replies 0 0
Address Masks 0 0
Address Mask Replies 0 0
TCP Statistics
Active Opens = 597
Passive Opens = 135
Failed Connection Attempts = 107
Reset Connections = 91
Current Connections = 8
Segments Received = 106770
Segments Sent = 118431
Segments Retransmitted = 461
UDP Statistics
Datagrams Received = 4157136
No Ports = 351928
Receive Errors = 2
Datagrams Sent = 13809