Home >Operation and Maintenance >Linux Operation and Maintenance >How to check whether the remote server port is open in Linux

How to check whether the remote server port is open in Linux

藏色散人
藏色散人Original
2023-03-21 09:50:027700browse

Linux method to check whether the remote server port is open: 1. Check whether the port is open through the "nmap ip -p port" command. The specific command is such as "nmap 172.17.193.18 -p 5902"; 2. Through "nc -v ip port" command to check whether the port is open, the specific command is such as "nc -v 172.17.193.18 5902".

How to check whether the remote server port is open in Linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

linux How to check whether the remote server port is open?

linux detects whether the remote port is open

Commonly used telnet ip port method (such as telnet 172.17.193.18 5902) to test whether the remote host port is open, or to test whether the firewall between the current environment and the remote host port is open.

Telnet

[root@oldboy ~]# telnet baidu.com 80
  Trying 123.125.114.144...
  Connected to baidu.com (123.125.114.144). #==>出现Connected表示连通了,说明百度的80端口开放的
  Escape character is '^]'. #==>ctrl+]退出此地。
  ^]
  telnet> quit
  Connection closed.

In addition to telnet, you can also use:

Method 1: nmap ip -p port, such as nmap 172.17.193.18 - p 5902

Determine whether the port is open based on the displayed closed/open.

If it displays: 5902/tcp open vnc-2

, it means the remote port is open.

If it displays: 5902/tcp closed unknown

, it means the remote port is not open.

Method 2: nc -v ip port, such as nc -v 172.17.193.18 5902

Determine whether the port is open based on the displayed Connected information.

If it displays: Ncat:Connected to 172.17.193.18:5902.

, it means the remote port is open.

If it displays: Ncat:Connection refused.

, it means the remote port is not open.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to check whether the remote server port is open in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn