telnet 으로 포트 통신 상태 확인
1.ping test를 한다.
[svr:usr] ping 172.0.0.1
응답없으면(ping이 되지 않으면) firewall에 등록이 되지 않은 것이다.
정상적 결과 172.0.0.1 is alive
2.1.telnet ip port 로 확인한다.
[svr:usr] telnet 172.0.0.1 9999
Trying 172.0.0.1...
계속 대기 중이면 방화벽 오픈이 안된 것이다.
2.2
[svr:usr] telnet 172.0.0.1 9999
Trying 172.0.0.1...
telnet: Unable to connect to remote host: Connection refused
바로 연결거부가 발생하면 방화벽 오픈은 되었으나 프로세스가 안 떠있는 것이다.
(포트를 열고 대기하고 있지 않은 상태)
2.3
[svr:usr] telnet 172.0.0.1 9999
Trying 172.0.0.1...
Connected to 172.0.0.1
Escape character is '^]'.
방화벽 오픈이 정상적으로 되었고 프로세스가 올라가 있는 것이다.
(포트를 열고 대기하고 있는 상태)
=> 이상태가 되야 통신테스트를 할 수 있다
2.4
[svr:usr] telnet 172.0.0.1 9999
Trying 172.0.0.1...
Connected to 172.0.0.1
Escape character is '^]'.
Connection closed by foreign host.
=> 서버/클라이언트 사이에 해당 포트는 모두 열려 있어서, 일단 정상적으로 접속은 됐으나,
어떤 원이에 의해서 서버가 접속을 강제로 close 함
--> 해당 port를 사용하는 Application의 Client가 Signal을 보내지 않아 끊어질 수 있음
3. 라우팅 테이블 확인하기
[svr:usr] netstat -rn | grep 172.0.0.1
172.0.0.1 172.0.0.1 UG 1 186064
여기에 값이 있으면 올바로 설정된 것임.
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>
- 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 다운로드 URL
- 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
https://scbyun.com/entry/%EB%AA%85%EB%A0%B9%EC%96%B4-ping-telnet%EC%9C%BC%EB%A1%9C-%ED%86%B5%EC%8B%A0%ED%8F%AC%ED%8A%B8-%EC%83%81%ED%83%9C-%ED%99%95%EC%9D%B8
- tcping(for linux) https://scbyun.com/793
- tcping(for windows) https://scbyun.com/622
'ㆍ Linux' 카테고리의 다른 글
Linux, 부팅, swap, dependency, booting (0) | 2023.08.30 |
---|---|
blk_update_request: I/O error, dev, sector (0) | 2023.08.22 |
udev, user device, systemd, failed to get udev event, udev rule (0) | 2023.08.14 |
coredump, 세그먼트 폴트, segfault at 0 ip error 4 in libc-2.28.so (0) | 2023.08.09 |
rtkit, RealtimeKit, rtkit-daemon, 실시간 정책 및 Watchdog 데몬 (0) | 2023.07.20 |