首页 > 代码库 > 如何查看服务器是否开放某个端口

如何查看服务器是否开放某个端口

以查询873端口为例:

      # ss -lntup|grep 873

[root@backup nfsbackup]# ss-lnutp|grep 873

tcp   LISTEN     0      64                    :::873                  :::*      users:(("xinetd",1810,5))

[root@backup nfsbackup]#

 

      # netstat -lntup|grep 873

[root@backup nfsbackup]# netstat-lnutp|grep 873

tcp        0     0 :::873                     :::*                        LISTEN      1810/xinetd        

[root@backup nfsbackup]#

 

      # lsof -i :873

[root@backup nfsbackup]# lsof -i:873

COMMAND  PID USER  FD   TYPE DEVICE SIZE/OFF NODENAME

xinetd  1810 root   5u  IPv6  12433     0t0  TCP *:rsync (LISTEN)

[root@backup nfsbackup]#

 

      # telnet 10.0.0.41 873linux yuminstall telnet

[root@web02 ~]# telnet 172.16.1.41873

Trying 172.16.1.41...

Connected to 172.16.1.41.

Escape character is ‘^]‘.

@RSYNCD: 30.0

 

      # nc 10.0.0.41 873

[root@web02 ~]# nc 172.16.1.41 873

@RSYNCD: 30.0

 

   # nmap -p 873 10.0.0.41

[root@web02 ~]#nmap -p 873 172.16.1.41          ##扫描主机

 

Starting Nmap 5.51 ( http://nmap.org) at 2017-05-13 13:41 CST

Nmap scan report for backup (172.16.1.41)

Host is up (0.00069s latency).

PORT    STATE SERVICE

873/tcp open  rsync

MAC Address: 00:0C:29:01:17:0F(VMware)

 

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

[root@web02 ~]# nmap-p 873 172.16.1.0/24           ###扫描网段

 

Starting Nmap 5.51 ( http://nmap.org) at 2017-05-13 13:41 CST

Nmap scan report for web01(172.16.1.7)

Host is up (0.00018s latency).

PORT    STATE SERVICE

873/tcp closed rsync

 

Nmap scan report for web02(172.16.1.8)

Host is up (0.00072s latency).

PORT    STATE SERVICE

873/tcp closed rsync

MAC Address: 00:0C:29:B1:33:AE(VMware)

 

Nmap scan report for nfs01(172.16.1.31)

Host is up (0.00039s latency).

PORT    STATE SERVICE

873/tcp closed rsync

MAC Address: 00:0C:29:86:08:29(VMware)

 

Nmap scan report for backup(172.16.1.41)

Host is up (0.00057s latency).

PORT    STATE SERVICE

873/tcp open  rsync

MAC Address: 00:0C:29:01:17:0F(VMware)

 

Nmap done: 256 IP addresses (4 hostsup) scanned in 2.02 seconds

[root@web02 ~]#


本文出自 “12672150” 博客,请务必保留此出处http://12682150.blog.51cto.com/12672150/1925576

如何查看服务器是否开放某个端口