nmap扫描服务器端口(远程桌面端口)
我经常用它来检测远程的 windows服务器的ip地址,因为不是固定ip地址,该服务器的ip地址会经常变化,但是有个规律,只在一个网段内变化,这样就给ip地址的确定带来 了方便。
1. 如果没有安装nmap,就安装
yum install -y nmap
2. 扫描指定网段的远程桌面连接端口
nmap -st -p3389 218.206.112.0/24
3. 如果觉得输出太多,可以用 grep 命令过滤
nmap -st -p3389 218.206.112.0/24 | grep -b2 open
下面是操作的消息记录,备查。
[root@node18 opt]# nmap
-bash: nmap: command not found
[root@node18 opt]# yum install -y nmap
...
[root@node18 opt]# nmap -st -p3389 218.206.112.0/24
starting nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2012-10-26 15:36 cst
interesting ports on 218.206.112.1:
port state service
3389/tcp closed ms-term-serv
interesting ports on 218.206.112.11:
port state service
3389/tcp filtered ms-term-serv
...
[root@node18 opt]# nmap -st -p3389 218.206.112.0/24 | grep -b2 open
interesting ports on 218.206.112.100:
port state service
3389/tcp open ms-term-serv
--
interesting ports on 218.206.112.132:
port state service
3389/tcp open ms-term-serv
[root@node18 opt]#