<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>방화벽 포트 확인 Archives - pigletstory 블로그</title>
	<atom:link href="https://pigletstory.co.kr/tag/%EB%B0%A9%ED%99%94%EB%B2%BD-%ED%8F%AC%ED%8A%B8-%ED%99%95%EC%9D%B8/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>pigletstory</description>
	<lastBuildDate>Wed, 18 Nov 2026 01:41:54 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>
<site xmlns="com-wordpress:feed-additions:1">221109878</site>	<item>
		<title>telnet으로 포트 통신 확인하는 방법 (윈도우 cmd, 리눅스 nc·bash·curl)</title>
		<link>https://pigletstory.co.kr/2165/</link>
					<comments>https://pigletstory.co.kr/2165/#respond</comments>
		
		<dc:creator><![CDATA[piglet]]></dc:creator>
		<pubDate>Wed, 02 Aug 2023 04:35:48 +0000</pubDate>
				<category><![CDATA[IT 정보]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Connection refused]]></category>
		<category><![CDATA[nc 명령어]]></category>
		<category><![CDATA[telnet 통신 확인]]></category>
		<category><![CDATA[telnet 포트 확인]]></category>
		<category><![CDATA[방화벽 포트 확인]]></category>
		<category><![CDATA[포트확인]]></category>
		<guid isPermaLink="false">https://pigletstory.co.kr/562-2/</guid>

					<description><![CDATA[<p>서버를 새로 만들거나 방화벽을 열고 나면 &#8220;그 포트로 실제로 접속이 되는지&#8221;부터 확인하게 됩니다. 가장 오래된 방법은 telnet IP 포트입니다. 이 글에서는 윈도우 cmd에서 telnet으로 확인하는 방법과, telnet이 설치돼 있지 않은 리눅스 서버에서 쓸 수 있는 방법을 실제 결과와 함께 정리했습니다. 특히 &#8220;Connection refused&#8221;와 &#8220;응답 없음(timeout)&#8221;은 원인이 완전히 다르다는 점을 꼭 알고 가시면 좋습니다. 1. 윈도우 ... <a title="telnet으로 포트 통신 확인하는 방법 (윈도우 cmd, 리눅스 nc·bash·curl)" class="read-more" href="https://pigletstory.co.kr/2165/" aria-label="telnet으로 포트 통신 확인하는 방법 (윈도우 cmd, 리눅스 nc·bash·curl)에 대해 더 자세히 알아보세요">더 읽기</a></p>
<p>The post <a href="https://pigletstory.co.kr/2165/">telnet으로 포트 통신 확인하는 방법 (윈도우 cmd, 리눅스 nc·bash·curl)</a> appeared first on <a href="https://pigletstory.co.kr">pigletstory 블로그</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>서버를 새로 만들거나 방화벽을 열고 나면 <strong>&#8220;그 포트로 실제로 접속이 되는지&#8221;</strong>부터 확인하게 됩니다. 가장 오래된 방법은 <code>telnet IP 포트</code>입니다. 이 글에서는 윈도우 cmd에서 telnet으로 확인하는 방법과, <strong>telnet이 설치돼 있지 않은 리눅스 서버</strong>에서 쓸 수 있는 방법을 실제 결과와 함께 정리했습니다.</p>
<p>특히 <strong>&#8220;Connection refused&#8221;와 &#8220;응답 없음(timeout)&#8221;은 원인이 완전히 다르다</strong>는 점을 꼭 알고 가시면 좋습니다.</p>
<h2>1. 윈도우 cmd에서 telnet으로 확인</h2>
<p>cmd 창에서 <strong><code>telnet IP 포트</code></strong> 순서로 입력합니다.</p>
<pre><code>telnet 192.168.0.10 3389</code></pre>
<p>윈도우 10/11에는 telnet 클라이언트가 기본으로 꺼져 있습니다. &#8220;&#8216;telnet&#8217;은(는) 내부 또는 외부 명령&#8230; 이 아닙니다&#8221;라는 메시지가 나오면 <strong>제어판 → 프로그램 및 기능 → Windows 기능 켜기/끄기 → 텔넷 클라이언트</strong>를 체크해서 설치하세요.</p>
<p>접속이 안 되면 &#8220;연결하지 못했습니다&#8221;라는 실패 메시지가 나옵니다. 방화벽이 열려 있지 않거나, 서버에서 해당 포트를 쓰는 프로그램이 떠 있지 않은 상태입니다.</p>
<p>접속이 되면 <strong>화면이 지워지고 커서만 깜빡이는 빈 창</strong>으로 바뀝니다. 이게 정상적으로 연결된 상태입니다.</p>
<p>빠져나올 때는 <code>Ctrl + ]</code>를 누른 뒤 <code>quit</code>을 입력합니다.</p>
<p>PowerShell을 쓸 수 있다면 telnet을 설치하지 않고 이 명령으로도 확인할 수 있습니다. 결과의 <code>TcpTestSucceeded</code>가 True면 열린 것입니다.</p>
<pre><code>Test-NetConnection 192.168.0.10 -Port 3389</code></pre>
<h2>2. 리눅스에는 telnet이 없는 경우가 많다</h2>
<p>이 블로그가 돌아가는 Ubuntu 24.04 클라우드 서버에서 확인해 보니 <strong>telnet도 nc(netcat)도 설치돼 있지 않았습니다.</strong></p>
<pre><code>$ which telnet nc curl
/usr/bin/curl</code></pre>
<p>세 개를 찾았는데 curl만 나왔습니다.</p>
<p>최소 설치 이미지에서는 흔한 일입니다. 설치해서 쓰려면 아래 명령을 쓰면 되고, <strong>설치 없이 확인하는 방법</strong>도 아래에 정리했습니다.</p>
<pre><code># Ubuntu / Debian
sudo apt install telnet netcat-openbsd

# Rocky / RHEL / CentOS
sudo dnf install telnet nmap-ncat      # CentOS 7은 yum

# 사용법
telnet 대상IP 포트
nc -zv 대상IP 포트          # -z: 데이터 없이 연결만, -v: 결과 출력
nc -zv -w 3 대상IP 포트     # 3초 안에 응답 없으면 포기</code></pre>
<h2>3. 설치 없이 확인 ① bash /dev/tcp</h2>
<p>bash에는 <code>/dev/tcp/호스트/포트</code>로 TCP 연결을 여는 기능이 들어 있습니다. <strong>아무것도 설치하지 않아도</strong> 거의 모든 리눅스에서 됩니다. 이 서버에서 실제로 실행한 결과입니다.</p>
<pre><code>$ timeout 3 bash -c '&lt;/dev/tcp/127.0.0.1/443' &amp;&amp; echo open || echo closed
open

$ timeout 3 bash -c '&lt;/dev/tcp/127.0.0.1/8081' &amp;&amp; echo open || echo closed
bash: connect: Connection refused
bash: line 1: /dev/tcp/127.0.0.1/8081: Connection refused
closed

$ time (timeout 3 bash -c '&lt;/dev/tcp/example.com/81' &amp;&amp; echo open || echo closed)
closed

real	0m3.002s</code></pre>
<p>세 결과가 각각 다른 상황입니다.</p>
<ul>
<li><strong>443 → open</strong>: 웹서버(nginx)가 듣고 있어서 바로 연결됐습니다.</li>
<li><strong>8081 → Connection refused (즉시)</strong>: 서버까지는 도달했지만 <strong>그 포트를 쓰는 프로그램이 없습니다.</strong> 서버가 &#8220;여기 아무도 없음&#8221;이라고 바로 거절한 것입니다.</li>
<li><strong>example.com:81 → 3초 동안 아무 응답 없음</strong>: 중간 어딘가에서 <strong>방화벽이 패킷을 조용히 버리고</strong> 있을 때 이렇게 됩니다. 앞에 <code>timeout 3</code>을 붙이지 않으면 한참을 기다립니다.</li>
</ul>
<p>bash 전용 기능이라 <code>sh</code>나 <code>zsh</code>에서는 안 되니, 꼭 <code>bash -c</code>로 실행하세요.</p>
<h2>4. 설치 없이 확인 ② curl telnet://</h2>
<p>curl은 대부분의 서버에 기본으로 들어 있고, <code>telnet://</code> 주소를 주면 telnet처럼 포트에 연결만 해 봅니다. 메시지가 자세해서 원인 파악에 좋습니다.</p>
<pre><code>$ curl -v -m 2 telnet://127.0.0.1:443 &lt;/dev/null
*   Trying 127.0.0.1:443...
* Connected to 127.0.0.1 (127.0.0.1) port 443
* Time-out
curl: (28) Time-out</code></pre>
<p>열린 포트는 <strong><code>Connected to</code></strong>가 찍힙니다. 그 뒤의 Time-out은 연결된 채로 2초(<code>-m 2</code>)를 기다리다 끝난 것이라 신경 쓰지 않아도 됩니다. <code>-m</code>을 빼면 서버가 연결을 끊을 때까지 계속 붙어 있으니 꼭 넣어 주세요. 실제로 빼고 실행했더니 1분 넘게 멈춰 있었습니다.</p>
<pre><code>$ curl -v --connect-timeout 3 telnet://127.0.0.1:8081 &lt;/dev/null
*   Trying 127.0.0.1:8081...
* connect to 127.0.0.1 port 8081 from 127.0.0.1 port 36810 failed: Connection refused
* Failed to connect to 127.0.0.1 port 8081 after 0 ms: Couldn't connect to server</code></pre>
<pre><code>$ curl -v --connect-timeout 3 telnet://example.com:81 &lt;/dev/null
*   Trying 104.20.23.154:81...
* ipv4 connect timeout after 1500ms, move on!
*   Trying 172.66.147.243:81...
* ipv4 connect timeout after 1497ms, move on!
* Failed to connect to example.com port 81 after 3000 ms: Timeout was reached</code></pre>
<p>여기서도 거절은 <strong>0 ms</strong> 만에, 방화벽 차단은 <strong>제한 시간(3000 ms)을 다 채우고</strong> 끝났습니다. 도메인에 IP가 여러 개면 curl이 하나씩 차례로 시도하는 것도 보입니다.</p>
<h2>5. 결과 읽는 법: refused와 timeout은 다르다</h2>
<table>
<thead>
<tr>
<th>결과</th>
<th>의미</th>
<th>확인할 곳</th>
</tr>
</thead>
<tbody>
<tr>
<td>연결됨 (Connected / open / 빈 화면)</td>
<td>네트워크·방화벽·서비스 모두 정상</td>
<td>&#8211;</td>
</tr>
<tr>
<td><strong>Connection refused</strong> (즉시 실패)</td>
<td>서버에 도달했지만 그 포트에서 듣는 프로그램이 없음</td>
<td>서버의 서비스가 떠 있는지, 포트 번호가 맞는지, 127.0.0.1에만 묶여 있지 않은지</td>
</tr>
<tr>
<td><strong>Timeout</strong> (한참 뒤 실패)</td>
<td>패킷이 중간에서 버려짐</td>
<td>서버 방화벽(ufw, firewalld, iptables), 클라우드 보안 그룹, 사내 방화벽</td>
</tr>
</tbody>
</table>
<p>원래 이 글에서는 &#8220;접속이 안 되면 방화벽이 안 열린 것&#8221;이라고만 적었는데, 정확히는 <strong>바로 거절되면 서비스 문제, 오래 기다리다 실패하면 방화벽 문제</strong>일 가능성이 큽니다. 다만 방화벽 설정에 따라 차단할 때도 바로 거절 응답을 보내는 경우가 있으니(<code>REJECT</code> 규칙), refused가 나왔다면 서버 쪽 서비스와 방화벽을 둘 다 확인하세요.</p>
<h2>6. 서버 쪽에서 포트가 열려 있는지 확인</h2>
<p>밖에서 refused가 나오면 서버에 들어가서 해당 포트를 정말 듣고 있는지 봅니다. 이 서버의 실제 결과 중 일부를 보기 쉽게 줄였습니다(프로세스 번호 등 생략).</p>
<pre><code>$ sudo ss -ltnp
State   Local Address:Port   Process
LISTEN  127.0.0.1:3306       users:(("mariadbd",...))
LISTEN  0.0.0.0:80           users:(("nginx",...))
LISTEN  0.0.0.0:443          users:(("nginx",...))</code></pre>
<p><code>0.0.0.0:443</code>은 모든 네트워크에서 접속을 받고, <code>127.0.0.1:3306</code>(MariaDB)은 <strong>서버 자기 자신에서만</strong> 접속을 받는다는 뜻입니다. 그래서 다른 PC에서 이 서버의 3306 포트로 telnet을 하면 방화벽을 열어도 연결되지 않습니다. 사용 중인 포트를 확인하는 방법은 <a href="https://pigletstory.co.kr/1396/">리눅스 사용 중인 포트 확인 방법</a>에 따로 정리했습니다.</p>
<h2>정리</h2>
<ul>
<li>윈도우: <code>telnet IP 포트</code> (텔넷 클라이언트 설치 필요) 또는 PowerShell <code>Test-NetConnection IP -Port 포트</code></li>
<li>리눅스, 설치 가능: <code>nc -zv -w 3 IP 포트</code></li>
<li>리눅스, 설치 없이: <code>timeout 3 bash -c '&lt;/dev/tcp/IP/포트'</code> 또는 <code>curl -v -m 3 telnet://IP:포트</code></li>
<li><strong>즉시 refused → 서비스·포트 확인, 한참 뒤 timeout → 방화벽 확인</strong></li>
</ul>
<p>The post <a href="https://pigletstory.co.kr/2165/">telnet으로 포트 통신 확인하는 방법 (윈도우 cmd, 리눅스 nc·bash·curl)</a> appeared first on <a href="https://pigletstory.co.kr">pigletstory 블로그</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pigletstory.co.kr/2165/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2165</post-id>	</item>
	</channel>
</rss>
