Nmapコマンドを利用して開いているポートを確認する (Linux)

提供:あわ自由帳

nmapのインストール

CentOS 7 で確認しました。

[root@host3 ~]# yum -y install nmap

nmapコマンドで自機の開いているポートを調べる

[root@host3 ~]# nmap localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2014-08-30 11:37 JST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000047s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 984 closed ports
PORT     STATE    SERVICE
22/tcp   open     ssh
25/tcp   open     smtp
53/tcp   open     domain
80/tcp   open     http
110/tcp  open     pop3
135/tcp  filtered msrpc
139/tcp  filtered netbios-ssn
143/tcp  open     imap
443/tcp  open     https
445/tcp  filtered microsoft-ds
465/tcp  open     smtps
783/tcp  open     spamassassin
993/tcp  open     imaps
995/tcp  open     pop3s
3306/tcp open     mysql

nmapコマンドで他のマシンの開いているポートを調べる

[root@host3 ~]# nmap 192.168.1.2                                                

Starting Nmap 6.40 ( http://nmap.org ) at 2014-08-30 11:48 JST
Nmap scan report for 192.168.1.2
Host is up (0.00042s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
443/tcp  open  https
445/tcp  open  microsoft-ds
3306/tcp open  mysql
MAC Address: 78:E7:D1:DA:83:3C (Hewlett-Packard Company)

Nmap done: 1 IP address (1 host up) scanned in 3.34 seconds