<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>ze-rith.log</title>
        <link>https://velog.io/</link>
        <description>화이트 해커</description>
        <lastBuildDate>Tue, 26 May 2026 07:15:15 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>ze-rith.log</title>
            <url>https://velog.velcdn.com/images/ze-rith/profile/6e453d44-3053-4380-84a7-0fd26f48722b/image.jpeg</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. ze-rith.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/ze-rith" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[2026/05/26]]></title>
            <link>https://velog.io/@ze-rith/20260526</link>
            <guid>https://velog.io/@ze-rith/20260526</guid>
            <pubDate>Tue, 26 May 2026 07:15:15 GMT</pubDate>
            <description><![CDATA[<p>진로를 정했다.
사이버 범죄 수사대
그래서 오늘은 앞으로의 로드맵을 만들어 봤다.
프로그래밍 기능사 실기책도 구매 했다.
앞으로 운동도 자주 해야겠다.
미래를 걱정하지 말고 지금을 살아보자.</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[iptables]]></title>
            <link>https://velog.io/@ze-rith/iptables</link>
            <guid>https://velog.io/@ze-rith/iptables</guid>
            <pubDate>Mon, 13 Apr 2026 08:03:18 GMT</pubDate>
            <description><![CDATA[<h1 id="iptables-완벽-정리-리눅스-방화벽의-핵심-이해하기">iptables 완벽 정리: 리눅스 방화벽의 핵심 이해하기</h1>
<p>리눅스 서버를 운영하거나 보안을 공부하다 보면 반드시 만나게 되는 것이 바로 <strong>iptables</strong>입니다.
iptables는 리눅스에서 네트워크 패킷을 필터링하고 제어하는 강력한 도구로, 일종의 <strong>방화벽(Firewall)</strong> 역할을 합니다.</p>
<p>이번 글에서는 iptables의 기본 개념부터 실전 명령어까지 정리해보겠습니다.</p>
<hr>
<h2 id="📌-iptables란">📌 iptables란?</h2>
<p>iptables는 리눅스 커널의 <strong>Netfilter</strong> 기능을 기반으로 동작하는 사용자 공간 도구입니다.
네트워크를 통해 들어오고 나가는 패킷을 규칙(rule)에 따라 허용하거나 차단할 수 있습니다.</p>
<p>✔ 쉽게 말하면:</p>
<blockquote>
<p>&quot;들어오는 트래픽과 나가는 트래픽을 내가 원하는 대로 통제하는 시스템&quot;</p>
</blockquote>
<hr>
<h2 id="기본-구조-이해하기">기본 구조 이해하기</h2>
<p>iptables는 다음과 같은 구조로 이루어져 있습니다:</p>
<pre><code>Table → Chain → Rule</code></pre><h3 id="1️⃣-table-테이블">1️⃣ Table (테이블)</h3>
<p>iptables에는 여러 테이블이 존재합니다.</p>
<ul>
<li><code>filter</code> : 기본 테이블 (패킷 허용/차단)</li>
<li><code>nat</code> : IP 변환 (포트포워딩 등)</li>
<li><code>mangle</code> : 패킷 수정</li>
<li><code>raw</code> : 연결 추적 제외</li>
</ul>
<hr>
<h3 id="2️⃣-chain-체인">2️⃣ Chain (체인)</h3>
<p>각 테이블에는 체인이 존재합니다.</p>
<ul>
<li><code>INPUT</code> : 들어오는 패킷</li>
<li><code>OUTPUT</code> : 나가는 패킷</li>
<li><code>FORWARD</code> : 다른 곳으로 전달되는 패킷</li>
</ul>
<hr>
<h3 id="3️⃣-rule-규칙">3️⃣ Rule (규칙)</h3>
<p>체인 안에 있는 실제 필터링 규칙입니다.</p>
<p>예:</p>
<ul>
<li>특정 IP 차단</li>
<li>특정 포트 허용</li>
</ul>
<hr>
<h2 id="기본-명령어-정리">기본 명령어 정리</h2>
<h3 id="✔-현재-규칙-확인">✔ 현재 규칙 확인</h3>
<pre><code class="language-bash">iptables -L</code></pre>
<hr>
<h3 id="✔-특정-ip-차단">✔ 특정 IP 차단</h3>
<pre><code class="language-bash">iptables -A INPUT -s 192.168.0.10 -j DROP</code></pre>
<p>192.168.0.10에서 오는 모든 패킷 차단</p>
<hr>
<h3 id="✔-특정-포트-허용-예-80번-http">✔ 특정 포트 허용 (예: 80번 HTTP)</h3>
<pre><code class="language-bash">iptables -A INPUT -p tcp --dport 80 -j ACCEPT</code></pre>
<hr>
<h3 id="✔-기본-정책-설정">✔ 기본 정책 설정</h3>
<pre><code class="language-bash">iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT</code></pre>
<hr>
<h2 id="실전-예시-기본-보안-설정">실전 예시 (기본 보안 설정)</h2>
<pre><code class="language-bash"># 초기화
iptables -F

# 기본 정책
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT

# 로컬 허용
iptables -A INPUT -i lo -j ACCEPT

# 기존 연결 허용
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

# SSH 허용 (22번 포트)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# HTTP 허용
iptables -A INPUT -p tcp --dport 80 -j ACCEPT</code></pre>
<hr>
<h2 id="3번-시도-후-차단-설정">3번 시도 후 차단 설정</h2>
<h3 id="✔-규칙-설정">✔ 규칙 설정</h3>
<ol>
<li><p>최근 접속 기록 확인 (3회 이상이면 차단)
iptables -A INPUT -p tcp --dport 22 <br>-m recent --name SSH --update --seconds 60 --hitcount 3 -j DROP</p>
</li>
<li><p>접속 시도 기록 추가
iptables -A INPUT -p tcp --dport 22 <br>-m recent --name SSH --set -j ACCEPT</p>
</li>
</ol>
<hr>
<h3 id="설정은-재부팅-시-초기화됨">설정은 재부팅 시 초기화됨</h3>
<p>iptables는 기본적으로 재부팅하면 사라집니다.</p>
<h4 id="해결-방법">해결 방법:</h4>
<pre><code class="language-bash">iptables-save &gt; /etc/iptables.rules</code></pre>
<p>또는</p>
<pre><code class="language-bash">netfilter-persistent save</code></pre>
<hr>
]]></description>
        </item>
    </channel>
</rss>