我经常用它来检测远程的 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]#