linux detect the remote port is open

  Common mode telnet ip port (e.g., Telnet 5902 172.17.193.18 ) Test remote host port is open, or for testing the current environment and a firewall between the remote host port opened or not.

  telnet

  [Oldboy the root @ ~] # 80 Telnet Baidu.com
  the Trying 123.125.114.144 ...
  Connected to Baidu.com (123.125.114.144). # ==> Connected expressed communication occurs, indicating the port 80 open Baidu
  Escape character is '^]'. # ==> ctrl +] quit here.
  ^]
  The Telnet> quit
  Connection Closed.

  In addition to telnet, you can also use:

  Method. 1: nmap -p IP Port , such as nmap 172.17.193.18 -p 5902

  The display closed / open port is open is determined.

  If it displays: 5902 / tcp open vnc-2

  It means that the remote port is open.

  If the display: 5902 / tcp closed unknown

  It means that the remote port is not open.

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

  Connected ports are open determined according to the information displayed.

  If the display: Ncat: Connected to 172.17.193.18:5902.

  It means that the remote port is open.

  If the display: Ncat: Connection refused.

  It means that the remote port is not open.

 

Guess you like

Origin www.cnblogs.com/codingmengmeng/p/11086761.html