netstat

王朝other·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

查看有谁连上了我的主机

使用命令netstat:

常用参数有以下几种:

1 netstat -a 显示本机所提供的所有服务状态:显示如下:

avtive internet connections (servers and established)

proto recv-q sebd-q local address foregin address state

tcp 0 0 *op3 *:* LISTEN

tcp 0 0 *:imap *:* LISTEN

tcp 0 0 *:ftp *:* LISTEN

tcp 0 0 *:ssh *:* LISTEN

tcp 0 0 *:smtp *:* LISTEN

tcp 0 20 192.168.1.2:ssh 192.168.1.11:1391 ESTABLISHED

udp 0 0 *:1238 *:*

Active UNIX domain sockets (servers and established)

Proto RefCnt Flags Type State I-Node Path

unix 10 [ ] DGRAM 768 /dev/log

unix 2 [ ] DGRAM 304058

unix 2 [ ] DGRAM 303994

从上面我们可以看到有一台192.168.1.11在通过1391端口连接到本机192.168.1.2提供的ssh服务了!

LISTEN 表示正在监听的服务

如果我想要知道 port 的号码呢 用这个参数:

netstat -an

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN

tcp 0 20 192.168.1.2:22 192.168.1.11:1391 ESTABLISHED

udp 0 0 0.0.0.0:1238 0.0.0.0:*

Active UNIX domain sockets (servers and established)

Proto RefCnt Flags Type State I-Node Path

unix 10 [ ] DGRAM 768 /dev/log

就知道它连到本机192.168.1.2的22号端口拉ESTABLISHED表示正在连接。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航