linuxシステム/Windowsシステム——テストポートが通じない(4つの方法)


Linuxシステムに対して:1、2、3、4つの方法があります.Windowsシステムに対して:1、5つの共通の方法があります.
目次
Linuxシステムに対して:1、2、3、4つの方法があります.Windowsシステムに対して:1、5つの共通の方法があります.
1、telnetで判断する
2、sshで判断する
3、wgetで判断する
4、ポートスキャンツールを使用する
5、専用工具tcpingを使ってアクセスする:
一般的に「telnet ip port」を使ってポートが通じないと判断しますが、テスト方法はこれだけではなく、いくつかの方法を共有しています.具体的な内容は下をご覧ください.
準備環境
ウェブサーバを起動して、ポートを提供します.
[wyq@localhost ~]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...
他のウェブサーバーでポートを提供するのも同じです.pythonが便利なので、ここで使います.
1、telnetで判断する
telnetはwindowsの標準サービスで、直接使うことができます.linuxマシンなら、telnetをインストールする必要があります.
使い方:telnet ip port
1)まずテルネットで存在しないポートを接続する.
[root@localhost ~]# telnet 10.0.250.3 80
Trying 10.0.250.3...
telnet: connect to address 10.0.250.3: Connection refused #         
2)既存のポートを再接続する
[root@localhost ~]# telnet localhost 22
Trying ::1...
Connected to localhost. #  Connected      
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
a
Protocol mismatch.
Connection closed by foreign host.
2、sshで判断する
sshはlinuxの標準的な構成であり、最も一般的である.
使い方:ssh-v-p portusername@ip
-vデバッグモード(ログを印刷します.)
-p指定ポート
usernameは自由にできます.
1)接続はポートが存在しません.
[root@localhost ~]# ssh 10.0.250.3 -p 80
ssh: connect to host 10.0.250.3 port 80: Connection refused
[root@localhost ~]# ssh 10.0.250.3 -p 80 -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.0.250.3 [10.0.250.3] port 80.
debug1: connect to address 10.0.250.3 port 80: Connection refused
ssh: connect to host 10.0.250.3 port 80: Connection refused
2)接続されているポート
[root@localhost ~]# ssh ... -p
a
^]
^C
[root@localhost ~]# ssh ... -p -v
OpenSSH_.p, OpenSSL ..e-fips Feb
debug: Reading configuration data /etc/ssh/ssh_config
debug: Applying options for *
debug: Connecting to ... [...] port .
debug: Connection established.
debug: permanently_set_uid: /
debug: identity file /root/.ssh/identity type -
debug: identity file /root/.ssh/identity-cert type -
debug: identity file /root/.ssh/id_rsa type -
debug: identity file /root/.ssh/id_rsa-cert type -
debug: identity file /root/.ssh/id_dsa type -
debug: identity file /root/.ssh/id_dsa-cert type -
a
^C
いいえ-vオプションも大丈夫です.
3、wgetで判断する
wgetはlinux下のダウンロードツールで、先にインストールする必要があります.
使い方:wget ip:port
1)接続が存在しないポート
[root@localhost ~]# wget ...:
---- ::-- http://.../
Connecting to ...:... failed: Connection refused.
2)接続されているポート
[root@localhost ~]# wget ...:
---- ::-- http://...:/
Connecting to ...:... connected.
HTTP request sent, awaiting response...
4、ポートスキャンツールを使用する
[root@localhost ~]# nmap ... -p
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
PORT STATE SERVICE
/tcp closed http
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
[root@localhost ~]# nmap ... -p
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
PORT STATE SERVICE
/tcp open http-proxy
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
[root@localhost ~]# nmap ...
Starting Nmap . ( http://nmap.org ) at -- : CST
Nmap scan report for ...
Host is up (.s latency).
Not shown: closed ports
PORT STATE SERVICE
/tcp open ssh
/tcp open rpcbind
/tcp open http-proxy
/tcp open unknown
MAC Address: B:A::CF:FD:D (Unknown)
Nmap done: IP address ( host up) scanned in . seconds
5、専用工具tcpingを使ってアクセスする:
ダウンロードソフトのアドレス:https://elifulkerson.com/projects/tcping.phpダウンロードできない場合は、本人のリソースからダウンロードできます.
 
締め括りをつける
ポートサービスを提供すると、tcpプロトコルが使用され、上記はウェブサーバを例としている.サーバーがより簡単なtcpサーバーなら、3つのツールも同じです.
3つのツールの共通点は、1.tcpプロトコルをベースにしています.2.指定されたポートにアクセスできます.この2つに従って、多くのツールを見つけることができます.
普通はwindowsの下でtcpingを使うのが比較的に便利で、linuxの下で個人は比較的にwgetを使うことが好きです.