반응형
ping, telnet으로 통신(포트) 상태 확인
- ping test(ICMP)
$ ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=105 time=26.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=105 time=26.5 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=105 time=26.5 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 26.519/26.523/26.529/0.133 ms
응답이 없으면(ping이 되지 않으면) firewall에 등록이 되지 않은 것이다.
- telnet ip port 확인(서비스 포트)
$ telnet 8.8.8.8 80
Trying 8.8.8.8...
계속 대기 중이면 방화벽 오픈이 안 된 것이다.
- 포트를 열고 대기하고 있지 않은 상태
$ telnet 8.8.8.8 80
Trying 8.8.8.8...
telnet: Unable to connect to remote host: Connection refused
바로 연결 거부가 발생하면 방화벽 오픈은 되었으나 프로세스가 안 떠 있는 것이다.
- 포트를 열고 대기하고 있지 않은 상태
$ telnet 8.8.8.8 80
Trying 8.8.8.8...
Connected to 8.8.8.8.
Escape character is '^]'.
Connection closed by foreign host.
방화벽 오픈이 정상적으로 되었고 프로세스가 올라가 있는 것이다.
- 라우팅 테이블 확인
netstat -rn
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.10.3.1 0.0.0.0 UG 0 0 0 eth0
10.10.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.169.254 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
tcping 명령
tcping(for linux)
- tcping 설치
yum install -y tcping
- tcping 사용법
Usage: tcping [-q] [-t timeout_sec] [-u timeout_usec] <host> <port>
728x90
- tcping 명령 실행
- closed
tcping sangchul.kr 80
$ tcping sangchul.kr 80
sangchul.kr port 80 closed.
- open
tcping sangchul.kr 80
$ tcping sangchul.kr 80
sangchul.kr port 80 open.
tcping sangchul.kr 443
$ tcping sangchul.kr 443
sangchul.kr port 443 open.
tcping(for windows)
- tcping 사용법
> tcping /? | more
--------------------------------------------------------------
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] [-js size] [-4] [-6] [-
c] [-g count] [-S source_address] [--file] [--tee filename] [-h] [-u] [--post] [--head] [--proxy-port port] [--proxy-ser
ver server] [--proxy-credentials username:password] [-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 : include jitter, using default rolling average
-js 5 : include jitter, with a rolling average size of (for instance) 5.
--tee : mirror output to a filename specified after '--tee'
-4 : prefer ipv4
-6 : prefer ipv6
-c : only show an output line on changed state
--file : treat the "server-address" as a filename instead, loop through file line by line
Note: --file is incompatible with options such as -j and -c as it is looping through different targets
Optionally accepts server-port. For example, "example.org 443" is valid.
-g 5 : for instance, give up if we fail 5 times in a row
-S _X_ : Specify source address _X_. Source must be a valid IP for the client computer.
- tcping 명령어 실행
tcping -h sangchul.kr
>tcping -h sangchul.kr
** Requesting from sangchul.kr:
(for various reasons, kbit/s is an approximation)
Probing 175.126.170.70:80/tcp - HTTP is open - time=7.632ms rcv_time=222.791 status=200 bytes=37050 kbit/s=~1330.394
Probing 175.126.170.70:80/tcp - HTTP is open - time=7.879ms rcv_time=178.562 status=200 bytes=37050 kbit/s=~1659.927
Probing 175.126.170.70:80/tcp - HTTP is open - time=7.787ms rcv_time=156.653 status=200 bytes=37051 kbit/s=~1892.136
Probing 175.126.170.70:80/tcp - HTTP is open - time=7.609ms rcv_time=155.861 status=200 bytes=37051 kbit/s=~1901.752
Ping statistics for 175.126.170.70:80
4 probes sent.
4 successful, 0 failed.
Approximate trip times in milli-seconds:
Minimum = 7.609ms, Maximum = 7.879ms, Average = 7.727ms
Approximate download times in milli-seconds:
Minimum = 155.861ms, Maximum = 222.791ms, Average = 178.467ms
tcping -d -t 1.1.1.1 7777
>tcping -d -t 1.1.1.1 7777
** Pinging continuously. Press control-c to stop **
2021:02:22 11:28:49 Probing 111.111.111.111:7777/tcp - No response - time=2012.647ms
2021:02:22 11:28:51 Probing 111.111.111.111:7777/tcp - No response - time=2007.161ms
2021:02:22 11:28:53 Probing 111.111.111.111:7777/tcp - No response - time=2006.367ms
...
2021:02:22 11:29:29 Probing 111.111.111.111:7777/tcp - Port is open - time=32.171ms
2021:02:22 11:29:31 Probing 111.111.111.111:7777/tcp - Port is open - time=22.162ms
2021:02:22 11:29:32 Probing 111.111.111.111:7777/tcp - Port is open - time=21.967ms
Control-C
Ping statistics for 111.111.111.111:7777
158 probes sent.
142 successful, 16 failed. (10.13% fail)
Approximate trip times in milli-seconds (successful connections only):
Minimum = 21.438ms, Maximum = 1015.360ms, Average = 29.750ms
참고URL
- tcping(for linux) https://scbyun.com/793
- tcping(for windows) https://scbyun.com/622
728x90
반응형
'리눅스' 카테고리의 다른 글
MySQL mysqlshow 명령어 (0) | 2020.09.04 |
---|---|
dig 명령어 (0) | 2020.09.04 |
[리눅스] quota | 사용자별 용량 제한 (0) | 2020.09.04 |
ntsysv 명령어 (0) | 2020.09.04 |
Logrotate를 설정하는 방법 (0) | 2020.09.04 |