어떻게 포트 가 통 하지 않 는 지 테스트 합 니까(네 가지 방법)

일반적인 상황 에서"telnet ip port"를 사용 하여 포트 가 통 하지 않 는 다 고 판단 합 니 다.사실 테스트 방법 은 이 뿐만 아니 라 여러 가지 방법 도 있 습 니 다.아래 의 작은 편집 은 여러분 에 게 몇 가지 방법 을 공유 하 였 습 니 다.구체 적 인 내용 은 아래 를 보 세 요.
준비 환경
포트 를 제공 하 는 웹 서버 를 시작 합 니 다.

[wyq@localhost ~]$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...
다른 웹 서버 로 포트 를 제공 하 는 것 도 마찬가지 입 니 다.python 이 편리 하기 때문에 여기 서 사용 합 니 다.
1.telnet 로 판단
telnet 는 windows 표준 서비스 로 직접 사용 할 수 있 습 니 다.Liux 기계 라면 telnet 을 설치 해 야 합 니 다.
용법:telnet ip port
1)존재 하지 않 는 포트 를 telnet 로 먼저 연결

[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 는 Liux 의 표준 설정 이 고 가장 자주 사용 되 는 포트 를 판단 할 수 있 습 니까?
용법: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

아니요.-브 이 옵션 도 돼 요.
3.wget 으로 판단
wget 은 Liux 에서 다운로드 하 는 도구 입 니 다.먼저 설치 해 야 합 니 다.
용법: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

총결산
포트 서 비 스 를 제공 하면 tcp 프로 토 콜 을 사 용 했 습 니 다.위 는 웹 서버 를 예 로 들 었 습 니 다.서버 가 더 간단 한 tcp 서버 라면 세 가지 도구 가 똑 같이 적 용 됩 니 다.
세 도구 의 공통점 은 다음 과 같다.1.tcp 프로 토 콜 을 바탕 으로 한다.2.지정 한 포트 에 접근 할 수 있 습 니 다.이 두 가 지 를 따라 많은 도 구 를 찾 을 수 있 습 니 다.
일반적으로 windows 에서 telnet 을 사용 하 는 것 이 비교적 편리 하 며,Liux 아래 에 서 는 개인 적 으로 wget 을 사용 하 는 것 을 비교적 좋아한다.

좋은 웹페이지 즐겨찾기