Linux is open Check the remote host port

Mode 1: telnet host port

telnet 118.31.63.105 9999

 

Mode 2: nc -v host port 

Mode 3: ssh -v -p port username @ ip

-v debug mode (print journal).

 

-p port specified

 

username can freely

 

 

 

Port connection does not exist

 

[wyq@localhost ~]$ ssh -v -p 9000 wyq@localhost

OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013

debug1: Reading configuration data /home/wyq/.ssh/config

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 51: Applying options for *

debug1: Connecting to localhost [127.0.0.1] port 9000.

debug1: connect to address 127.0.0.1 port 9000: Connection refused

ssh: connect to host localhost port 9000: Connection refused

"Connection refused" indicates that the port is not available

 

Port exists

 

[wyq@localhost ~]$ ssh -v -p 8080 wyq@localhost

OpenSSH_6.4, OpenSSL 1.0.1e-fips 11 Feb 2013

debug1: Reading configuration data /home/wyq/.ssh/config

debug1: Reading configuration data /etc/ssh/ssh_config

debug1: /etc/ssh/ssh_config line 51: Applying options for *

debug1: Connecting to localhost [127.0.0.1] port 8080.

debug1: Connection established.

debug1: identity file /home/wyq/.ssh/id_rsa type 1

debug1: identity file /home/wyq/.ssh/id_rsa-cert type -1

debug1: identity file /home/wyq/.ssh/id_dsa type -1

debug1: identity file /home/wyq/.ssh/id_dsa-cert type -1

debug1: identity file /home/wyq/.ssh/id_ecdsa type -1

debug1: identity file /home/wyq/.ssh/id_ecdsa-cert type -1

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_6.4

debug1: ssh_exchange_identification: <head>

debug1: ssh_exchange_identification: <title>Error response</title>

debug1: ssh_exchange_identification: </head>

debug1: ssh_exchange_identification: <body>

debug1: ssh_exchange_identification: <h1>Error response</h1>

debug1: ssh_exchange_identification: <p>Error code 400.

debug1: ssh_exchange_identification: <p>Message: Bad request syntax ('SSH-2.0-OpenSSH_6.4').

debug1: ssh_exchange_identification: <p>Error code explanation: 400 = Bad request syntax or unsupported method.

debug1: ssh_exchange_identification: </body>

ssh_exchange_identification: Connection closed by remote host

"Connection established" said that it has connected to the port

Published 85 original articles · won praise 45 · views 950 000 +

Guess you like

Origin blog.csdn.net/flysnownet/article/details/103887341