栏目分类
系统安全 | 服务器安全 | 网络安全 | 木马病毒 | 漏洞补丁 | 防火墙 | 系统安全 | 备份恢复 | 安全策略
系统优化 | 提速 | 优化性能 | 服务 | 清理垃圾
网络技巧 | 网络命令 | 网络技巧 | 网络访问 | 共享 | 网络管理
服务器技术 | Exchange | FTP服务器 | ISAServer | 域服务器 | Web服务器 | SQLServer | 其他服务器
系统技巧 | 系统管理 | 系统技巧 | 注册表 | 进程
windows新手入门 | 系统基础 | 网络基础 | 安装 | 技术前沿
系统故障 | 网络故障 | 开关机故障 | 系统故障 | 软件故障 | 当机故障
资讯动态
排行榜
·怎样制作一张万能的WinXP安装光盘(3)
·Windows操作系统中消除汉字乱码有绝招
·怎样制作一张万能的WinXP安装光盘(2)
·怎样制作一张万能的WinXP安装光盘(1)
·Windows操作系统中消除汉字乱码有绝招
·Windows操作系统万能Ghost全攻略(1)
·双绞线的连接方式
·Windows操作系统万能Ghost全攻略(2)
·Windows98怎样访问网上邻居以及设置共享
·惊天发现“回收站”里的小秘密
·Windows系统不能识别移动硬盘的四大原因
·剖析Windows的消息运行机制
·设置WindowsXP中远程桌面的连接
·在DOS下安装WindowsXP前必读
·关闭WIN2003关机事件跟踪程序
·制作可启动的Windows2000安装光盘
·妙法删除多余WindowsXP管理员账户
·挑战高难度的文件格式转换
·如何修改组策略的默认刷新间隔
·防止IE被流氓网站乱改

    您现在的位置: Linux宝库 >> Windows >> 系统技巧 >> 系统管理 >> 文章正文
NBTSTAT和NETSTAT这两个命令有什么区别?
Linux宝库 收集整理  作者:Linux宝库  时间:2007-12-31  收藏本站
来自:http://doc.linuxpk.com/36727.html
联系:linuxmine#gmail.com
分类:[系统管理]
  netstat和nbtstat可以说都是Windows下的网络检测工具,他们的输入形式很相似而且都是需要在安装了TCP/IP协议以后才可以使用的,但两者的功能却不同。首先我们来看看netstat这个命令:

  C:\>netstat -h

  Displays protocol statistics and current TCP/IP network connections.

  显示协议统计和当前的 TCP/IP 网络连接。

  NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]

  -a Displays all connections and listening ports.

  显示所有连接和侦听端口。

  此命令可以显示出你的计算机当前所开放的所有端口,其中包括TCP端口和UDP端口。有经验的管理员会经常的使用它,以此来查看计算机的系统服务是否正常,是否被“黑客”留下后门,木马等。比如说我就有一个习惯,在刚刚装了系统配置好服务器以后我就会运行一下netstat -a看看系统开放了什么端口,并记录下来,以便以后作为参考使用,当发现有不明的端口时就可以及时的做出对策。由于这个参数同时还会显示出当前计算机有什么人的IP正连接着你的服务器,所以也是一种实时入侵检测工具,如发现有个IP连接着不正常的端口,你也可以及时做出有效对策。示例:

  C:\>netstat -a

  Active Connections

  Proto Local Address Foreign Address State

  TCP iceblood:ftp iceblood.yofor.com:0 LISTENING

  TCP iceblood:telnet iceblood.yofor.com:0 LISTENING

  TCP iceblood:smtp iceblood.yofor.com:0 LISTENING

  TCP iceblood:http iceblood.yofor.com:0 LISTENING

  TCP iceblood:https iceblood.yofor.com:0 LISTENING

  ………………

  TCP iceblood:1171 iceblood.yofor.com:3306 ESTABLISHED

  TCP iceblood:ms-sql-s iceblood.yofor.com:0 LISTENING

  TCP iceblood:3306 iceblood.yofor.com:1171 ESTABLISHED

  ………………

  UDP iceblood:ms-sql-m *:*

  UDP iceblood:4000 *:*

  UDP iceblood:4001 *:*

  UDP iceblood:4002 *:*

  从上面的情况就可以知道我的计算机现在开放的TCP端口有ftp(21),telnet(23),smtp(25),http(80),https(443),1171连接着自己的mysql(3306),ms-sql-s(1433),UDP端口有ms-sql-m(1433),4000-4002都是我的OICQ。:P

  -e Displays Ethernet statistics. This may be combined with the -s option.

  显示以太网统计。该参数可以与 -s 选项结合使用。

  这个参数正如所说的,将在下面再跟大家说。

  -n Displays addresses and port numbers in numerical form.

  以数字格式显示地址和端口号(而不是尝试查找名称)。

  大家如果只输入netstat的话就会看见如下类似的结果:

  C:\>netstat

  Active Connections

  Proto Local Address Foreign Address State

  TCP iceblood:1171 iceblood.yofor.com:3306 ESTABLISHED

  TCP iceblood:3306 iceblood.yofor.com:1171 ESTABLISHED

  TCP iceblood:1219 202.109.72.40:6667 ESTABLISHED

  TCP iceblood:3566 SERVER-2:microsoft-ds ESTABLISHED

  你会发现这些和netstat -a有相同的地方,只不过netstat可以很清楚的列举出来当前和你连接的所有计算机,在Local Address和Foreign Address里你也发现大多数给出的只是计算机NetBios名,却还是不知道当前和你连接的IP,但如果你加上-n参数就不同了,示例如下:

  C:\>netstat -n

  Active Connections

  Proto Local Address Foreign Address State

  TCP 127.0.0.1:1171 127.0.0.1:3306 ESTABLISHED

  TCP 127.0.0.1:3306 127.0.0.1:1171 ESTABLISHED

  TCP 192.168.1.21:1219 202.109.72.40:6667 ESTABLISHED

  TCP 192.168.1.21:3566 192.168.1.3:445 ESTABLISHED

  TCP 192.168.1.21:3577 202.107.208.187:110 TIME_WAIT

  TCP 192.168.1.21:3578 192.168.1.24:445 ESTABLISHED

  看!是不是很明了了?对方的IP全部都出来了。其实-n参数其实也就是告诉netstat不解析对方计算机的NetBios名。

  -p proto Shows connections for the protocol specified by proto; proto may be TCP or UDP. If used with the -s option to display

  per-protocol statistics, proto may be TCP, UDP, or IP.

  显示由 protocol 指定的协议的连接;protocol 可以是 tcp 或 udp。如果与 -s 选项一同使用显示每个协议的统计,protocol 可以是 tcp udp、icmp 或 ip。

  这个参数你可以指定查看什么协议的连接状态,比如我想查看当前计算机正在连接的所有TCP端口,示例如下:

  C:\>netstat -p tcp

  Active Connections

  Proto Local Address Foreign Address State

  TCP iceblood:1171 iceblood.yofor.com:3306 ESTABLISHED

  TCP iceblood:3306 iceblood.yofor.com:1171 ESTABLISHED

  TCP iceblood:1219 202.109.72.40:6667 ESTABLISHED

  …………

  -r Displays the routing table.

  显示路由表的内容。

  这个没有特别的,可以输入netstat -r以后自己研究。

  -s Displays per-protocol statistics. By default, statistics are shown for TCP, UDP and IP; the -p option may be used to specify a subset of the default.

  显示每个协议的统计。默认情况下,显示 TCP、UDP、ICMP 和 IP 的统计。-p 选项可以用来指定默认的子集。

  这个参数让我们来配合-e来使用。

  C:\>netstat -s -e

  Interface Statistics

  Received Sent

  Bytes 505385542 41745793

  Unicast packets 150106 150547

  Non-unicast packets 313008 807

  Discards 0 0

  Errors 0 0

  Unknown protocols 327149

  IP Statistics

  Packets Received = 379906

  Received Header Errors = 0

  Received Address Errors = 215043

  Datagrams Forwarded = 0

  Unknown Protocols Received = 0

  Received Packets Discarded = 0

  Received Packets Delivered = 166002

  Output Requests = 151620

  Routing Discards = 0

  Discarded Output Packets = 0

  Output Packet No Route = 0

  Reassembly Required = 0

  Reassembly Successful = 0

  Reassembly Failures = 0

  Datagrams Successfully Fragmented = 0

  Datagrams Failing Fragmentation = 0

  Fragments Created = 0

  TCP Statistics

  Active Opens = 1556

  Passive Opens = 1

  Failed Connection Attempts = 4

  Reset Connections = 143

  Current Connections = 4

  Segments Received = 141243

  Segments Sent = 140462

  Segments Retransmitted = 477

  UDP Statistics

  Datagrams Received = 15125

  No Ports = 9634

  Receive Errors = 0

  Datagrams Sent = 10628

  看!嘿嘿!你的网络基本状态都在这里面,比如你接受了多少数据包,多少字节,有多少TCP端口打开,有多少UDP端口打开,太丰富了……这些就留给各位高手自己慢慢琢磨去了。

  interval Redisplays selected statistics, pausing interval seconds between each display. Press CTRL+C to stop redisplaying statistics. If omitted, netstat will print the current configuration information once.

  重新显示所选的统计,在每次显示之间暂停 interval 秒。按 CTRL+B 停止重新显示统计。如果省略该参数,netstat 将打印一次当前的配置信息。

  这个就是自己定义检查网络状况的时间的参数,比如我想每过10秒检查一次我的计算机当前TCP连接的状态你就输入netstat 10 -p tcp这样netstat就会每过10秒就把你所有的TCP端口检查一次。

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

  C:\>nbtstat

  Displays protocol statistics and current TCP/IP connections using NBT (NetBIOS over TCP/IP).

  该诊断命令使用 NBT(TCP/IP 上的 NetBIOS)显示协议统计和当前 TCP/IP 连接。

  NBTSTAT [ [-a RemoteName] [-A IP address] [-c] [-n] [-r] [-R] [-RR] [-s] [-S] [interval] ]

  -a (adapter status) Lists the remote machine\''s name table given its name

  使用远程计算机的名称列出其名称表。

  此参数可以通过远程计算机的NetBios名来查看他的当前状态。示例

  C:\>nbtstat -a iceblood

  本地连接:

  Node IpAddress: [192.168.1.2] Scope Id: []

  NetBIOS Remote Machine Name Table

  Name Type Status

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

  ICEBLOOD <00> UNIQUE Registered

  WORK <00> GROUP Registered

  ICEBLOOD <20> UNIQUE Registered

  WORK <1E> GROUP Registered

  ICEBLOOD <03> UNIQUE Registered

  ICEBLOOD$ <03> UNIQUE Registered

  LIU_ICEBLOOD <03> UNIQUE Registered

  MAC Address = 00-D0-09-52-91-DC

  看见了?从上面就可以知道我的计算机当前计算机的NetBios名为iceblood属于work组或域,当前有liu_iceblood登陆的该计算机,嘿嘿~全都出来了。当然你也可以把计算机名换为IP也就是netstat -a 192.168.1.21,效果和上面的一样。这就有点像UNIX/Linux的finger了,如果你经常

  
本文来自:http://doc.linuxpk.com/36727.html
 
     最新更新
·WinVista5342Glass半透明效果图
·详解WindowsVista系统父母控制功能(1)
·详解WindowsVista系统父母控制功能(2)
·解析WindowsVista系统中的UAP功能
·Vista资源管理器特点分析(1)
·Vista资源管理器特点分析(2)
·Vista资源管理器特点分析(3)
·WindowsVista消耗800M内存是真是假?
·体验Vista风格DesktopSidebar试用
·解密WindowsVista5270中的最新功能
·WindowsVista系统账户保护机制初探
·激活WindowsVista中几项隐藏功能
·WinVista使用感受:和经典菜单告别
·WindowsVista操作系统应用技巧两则
·体验UAC保护五种途径确保Vista安全性
·VistaRC1人性化大幅改进
·正反两极端细看微软Vista十大得失
·看微软内部如何对Vista测试
·开机不过180M:VistaBeta2极致优化
·WindowsVista操作系统磁盘整理全面解析
·Vista新技术介绍之磁盘碎片自动整理
·解析Vista与系统不协调的三大工具界面
·深入体验Vista5472
·功能大幅提高Vista主要特性揭密
·WindowsVista系列技术文本――AERO篇
·反对声音之外选择Vista的20大理由
·WindowsVista内置趣味实用工具大搜罗
·Vista你为游戏准备好了吗?
·WinVista内置DVD制作软件截图透露
·Vista系统完整备份功能