본문 바로가기

리눅스

[리눅스] ping, telnet으로 통신(포트) 상태 확인

728x90

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...

계속 대기 중이면 방화벽 오픈이 안 된 것이다.

728x90
$ 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
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) https://sangchul.kr/57
- tcping(for windows) https://sangchul.kr/127

728x90