歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

如何在linux下查看另一台主機的某個端口是否啟動命令

以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端口

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

nmap -p 1-200 目標主機 IP

#1-200為端口范圍

本文出自 “一路向北” 博客,請務必保留此出處http://showerlee.blog.51cto.com/2047005/1119506

 

Copyright © Linux教程網 All Rights Reserved