SSH測試遠程服務器端口的連通性

ssh是linux的標準配置並且最常用,可以用來判斷端口是否打開

用法: ssh -v -p port username@ip

-v 詳細模式(會打印日誌,顯示登錄的細節).
-p 指定端口

username 可以隨意
ip 待測試機器的ip

--------------------------------------------------------------------------------------------------------

pipci@HP:~$ ssh -v -p 111 [email protected]
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.10.10.6 [10.10.10.6] port 111.
debug1: Connection established.                           ##出現Connection established表示建立連接,也就代表着這個端口開放
debug1: key_load_public: No such file or directory
debug1: identity file /home/pipci/.ssh/id_rsa type -1
省略

pipci@HP:~$ ssh -v -p 222 [email protected]
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.10.10.6 [10.10.10.6] port 222.
debug1: connect to address 10.10.10.6 port 222: Connection refused
ssh: connect to host 10.10.10.6 port 222: Connection refused          ##出現Connection refused表示連接拒絕,也就代表着這個端口關閉
pipci@HP:~$

--------------------------------------------------------------------------------------------------------

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章