netstat
点击次数:29 次 发布日期:2008-11-29 15:39:39 作者:源代码网
|
源代码网推荐 查看有谁连上了我的主机 使用命令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表示正在连接。 源代码网推荐 源代码网推荐 源代码网供稿. |
