2016/02/28

[Windows][Network] tcping - ping과 비슷하게 tcp port가 동작하는지 확인하는 콘솔 프로그램(Update:20160229)

http://kiros33.blog.me/130191106287


Revision History
2016/02/29 09:27:24 - 0.31 버전 파일 추가 

Home Page

Product Page

Attach File


tcping은 tcp 포트가 동작하는지 확인해주는 프로그램입니다.
ping은 ICMP를 사용하기 때문에 특정 포트가 동작하는지 확인 할 수 없습니다. 따라서 전용 클라이언트 없이 3389나 1521 포트가 연결되어 있는지 확인하기 위해서 다음과 같이 Telnet 명령어를 사용하곤 했습니다.

 
성공한 경우 윈도우에서는 까맣게 나오기 때문에 명령어는 리눅스 기준으로 설명합니다.
telnet 10.211.55.3 3389
Trying 10.211.55.3...
Connected to 10.211.55.3.
Escape character is '^]'.

성공하지 못한 경우 다음과 같이 연결 오류가 발생합니다.
C:\>telnet 10.211.55.3 3388
연결 대상 10.211.55.3...호스트에 연결할 수 없습니다. 포트 3388: 연결하지 못했습니다.

Windows 7 이후에서는 telnet 명령어가 기본 설치되어 있지 않아서 다음처럼 명령을 찾을 수 없다고 나옵니다.
C:\>telnet
'telnet'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는
배치 파일이 아닙니다.

따라서 명령을 사용하려면 별로도 설치해주어야 합니다. (하단의 윈도우에 텔넷 클라이언트 설치하기 참조)

잡설이 길었습니다.

tcping을 사용하며 tcp 포트를 확인하기 위해 번거로운 과정없이 tcping.exe 실행파일만 하나 받으면 됩니다.

기본 포트는 80 입니다.
C:\>tcping 10.211.55.3

Probing 10.211.55.3:80/tcp - No response - time=2002.298ms
Probing 10.211.55.3:80/tcp - No response - time=2000.594ms
Probing 10.211.55.3:80/tcp - No response - time=2000.715ms
Probing 10.211.55.3:80/tcp - No response - time=2000.329ms

Ping statistics for 10.211.55.3:80
     4 probes sent.
     0 successful, 4 failed.
Was unable to connect, cannot provide trip statistics.

특정 포트의 동작 여부는 다음과 같이 체크합니다.
C:\>tcping 10.211.55.3 3389

Probing 10.211.55.3:3389/tcp - Port is open - time=3.059ms
Probing 10.211.55.3:3389/tcp - Port is open - time=1.111ms
Probing 10.211.55.3:3389/tcp - Port is open - time=1.126ms
Probing 10.211.55.3:3389/tcp - Port is open - time=1.087ms

Ping statistics for 10.211.55.3:3389
     4 probes sent.
     4 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 1.087ms, Maximum = 3.059ms, Average = 1.596ms

특히 http 관련 기능을 웹 사이트 혹은 특정 웹 페이지의 상태를 확인 하는데 유용하게 사용할 수 있습니다. (http:// 문자를 제외하고 주소를 입력하세요)

위의 -h 옵션 없는 경우와 결과가 다르게 표시됩니다.
http 의 상태 값을 status로 확인 할 수 있습니다. 성공한 경우 200 값이 반환됩니다.
C:\>tcping -h 10.211.55.3

** Requesting "" from 10.211.55.3:
(for various reasons, kbit/s is an approximation)

Probing 10.211.55.3:80/tcp - HTTP is open - time=2.575ms rcv_time=366.498 status=200 bytes=350 kbit/s=~7.640
Probing 10.211.55.3:80/tcp - HTTP is open - time=0.635ms rcv_time=1.165 status=200 bytes=350 kbit/s=~2404.052
Probing 10.211.55.3:80/tcp - HTTP is open - time=0.615ms rcv_time=0.923 status=200 bytes=350 kbit/s=~3033.258
Probing 10.211.55.3:80/tcp - HTTP is open - time=0.563ms rcv_time=0.889 status=200 bytes=350 kbit/s=~3149.961
  
Ping statistics for 10.211.55.3:80
     4 probes sent.
     4 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 0.563ms, Maximum = 2.575ms, Average = 1.097ms
Approximate download times in milli-seconds:
     Minimum = 0.889ms, Maximum = 366.498ms, Average = 92.369ms
  
없는 페이지를 요청한 경우 404 값이 반환됩니다.
C:\>tcping -h 10.211.55.3/index2.html

** Requesting "index2.html" from 10.211.55.3:
(for various reasons, kbit/s is an approximation)

Probing 10.211.55.3:80/tcp - HTTP is open - time=1.984ms rcv_time=1.435 status=404 bytes=1142 kbit/s=~6365.220
Probing 10.211.55.3:80/tcp - HTTP is open - time=0.612ms rcv_time=0.892 status=404 bytes=1142 kbit/s=~10244.449
Probing 10.211.55.3:80/tcp - HTTP is open - time=0.587ms rcv_time=0.949 status=404 bytes=1142 kbit/s=~9623.933
Probing 10.211.55.3:80/tcp - HTTP is open - time=0.691ms rcv_time=1.031 status=404 bytes=1142 kbit/s=~8860.440

Ping statistics for 10.211.55.3:80
     4 probes sent.
     4 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 0.587ms, Maximum = 1.984ms, Average = 0.968ms
Approximate download times in milli-seconds:
     Minimum = 0.892ms, Maximum = 1.435ms, Average = 1.077ms

웹 URL 형식으로 포트를 지정하는 경우 동작하지 않습니다.
C:\>tcping -h 10.211.55.3:8080/index.html

** Requesting "index.html" from 80:
(for various reasons, kbit/s is an approximation)

DNS: Could not find host - 10.211.55.3:8080, aborting

포트는 항상 맨 뒤에 붙여주어야 합니다.
C:\>tcping -h 10.211.55.3/index.html 8080

** Requesting "index.html" from 10.211.55.3:
(for various reasons, kbit/s is an approximation)

Probing 10.211.55.3:8080/tcp - HTTP is open - time=3.555ms rcv_time=1.655 status=200 bytes=350 kbit/s=~1691.741
Probing 10.211.55.3:8080/tcp - HTTP is open - time=0.605ms rcv_time=1.006 status=200 bytes=350 kbit/s=~2782.747
Probing 10.211.55.3:8080/tcp - HTTP is open - time=0.743ms rcv_time=0.940 status=200 bytes=350 kbit/s=~2979.674
Probing 10.211.55.3:8080/tcp - HTTP is open - time=0.639ms rcv_time=1.131 status=200 bytes=350 kbit/s=~2475.466

Ping statistics for 10.211.55.3:8080
     4 probes sent.
     4 successful, 0 failed.
Approximate trip times in milli-seconds:
     Minimum = 0.605ms, Maximum = 3.555ms, Average = 1.385ms
Approximate download times in milli-seconds:
     Minimum = 0.940ms, Maximum = 1.655ms, Average = 1.183ms

명령줄 옵션
C:\>tcping
--------------------------------------------------------------
tcping.exe by Eli Fulkerson
Please see http://www.elifulkerson.com/projects/ for updates.
--------------------------------------------------------------

Usage: tcping [-flags] server-address [server-port]

Usage (full): tcping [-t] [-d] [-i interval] [-n times] [-w ms] [-b n] [-r times] [-s] [-v] [-j] [--tee filename] [-h] [-u] [--post] [--head] [-f] server-address [server-port]

 -t     : ping continuously until stopped via control-c
 -n 5   : for instance, send 5 pings
 -i 5   : for instance, ping every 5 seconds
 -w 0.5 : for instance, wait 0.5 seconds for a response
 -d     : include date and time on each line
 -b 1   : enable beeps (1 for on-down, 2 for on-up,
                        3 for on-change, 4 for always)
 -r 5   : for instance, relookup the hostname every 5 pings
 -s     : automatically exit on a successful ping
 -v     : print version and exit
 -j [5] : include jitter.  Optional argument controls rolling average size.
 --tee  : mirror output to a filename specified after '--tee'
 -4     : prefer ipv4
 -6     : prefer ipv6
 -c     : only show an output line on changed state

HTTP Options:
 -h     : HTTP mode (use url without http:// for server-address)
 -u     : include target URL on each line
 --post : use POST rather than GET (may avoid caching)
 --head : use HEAD rather than GET
 --proxy-server : specify a proxy server
 --proxy-port   : specify a proxy port

Debug Options:
 -f     : force tcping to send at least one byte

        If you don't pass server-port, it defaults to 80.

윈도우에 텔넷 클라이언트 설치하기
윈도우 7
제어판 > 프로그램 및 기능 > Windows 기능 사용/사용 안 함 에서 사용 여부를 체크
 

윈도우 8
제어판 > 프로그램 및 기능 > Window 기능 켜기/끄기 에서 사용 여부를 체크

검색: Windows, 윈도우, Win, 윈, Network, 네트워크, PING, ICMP, Internet Control Message Protocol, 인터넷 제어 메시지 프로토콜, TCP, 

댓글 없음:

댓글 쓰기