以LINUX REDHAT6.3为例:

本机插入 REDHAT6.3系统ISO镜像CD1

1.配置yum本地安装源:

以root用户登录系统

mkdir /mnt/cdrom

mount -t iso9660 /dev/sr0 /mnt/cdrom

cd /etc/yum.repos.d

查看目录是否有.repo后缀文件,没有则创建一个.repo文件,文件名随意。

vi local.repo 

 
  

[LOCAL]

name=local

baseurl=file:///mnt/cdrom

enable=1

gpgcheck=0

yum clean all

2.安装nmap,并测试172.24.40.5是否开放80端口

 
  
  1. [root@openlab named]# yum install nmap 
  2. Loaded plugins: rhnplugin 
  3. Repository 'LOCAL' is missing name in configuration, using id 
  4. This system is not registered with RHN. 
  5. RHN support will be disabled. 
  6. Setting up Install Process 
  7. Resolving Dependencies 
  8. --> Running transaction check 
  9. ---> Package nmap.i686 2:5.21-3.el6 set to be updated 
  10. --> Finished Dependency Resolution 
  11.  
  12. Dependencies Resolved 
  13.  
  14. ================================================================================ 
  15.  Package         Arch            Version                 Repository        Size 
  16. ================================================================================ 
  17. Installing: 
  18.  nmap            i686            2:5.21-3.el6            LOCAL            2.2 M 
  19.  
  20. Transaction Summary 
  21. ================================================================================ 
  22. Install       1 Package(s) 
  23. Upgrade       0 Package(s) 
  24.  
  25. Total download size: 2.2 M 
  26. Installed size: 7.2 M 
  27. Is this ok [y/N]: y 
  28. Downloading Packages: 
  29. Running rpm_check_debug 
  30. Running Transaction Test 
  31. Transaction Test Succeeded 
  32. Running Transaction 
  33.   Installing     : 2:nmap-5.21-3.el6.i686                                   1/1  
  34.  
  35. Installed: 
  36.   nmap.i686 2:5.21-3.el6                                                         
  37.  
  38. Complete! 
 
  
  1. [root@openlab named]# nmap -p 80 172.24.40.5 
  2.  
  3. Starting Nmap 5.21 ( http://nmap.org ) at 2013-01-09 17:00 CST 
  4. mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers 
  5. Nmap scan report for 172.24.40.5 
  6. Host is up (0.00034s latency). 
  7. PORT   STATE SERVICE 
  8. 80/tcp open  http 
  9. MAC Address: 00:0C:29:4E:7D:FE (VMware) 
  10.  
  11. Nmap done: 1 IP address (1 host up) scanned in 0.07 seconds 

nmap -p 1-200 目标主机 IP

#1-200为端口范围