Communitygithub.com

홈랩 VLAN 분할

홈 네트워크를 IoT, 게스트, 신뢰 영역, 서버 트래픽을 위한 VLAN으로 분할합니다. UniFi, pfSense/OPNsense, MikroTik 환경에서 스위치 트렁크 설정, 방화벽 규칙, 무선 SSID 매핑을 포함합니다. 홈 네트워크를 IoT, 게스트, 신뢰 영역, 서버 VLAN으로 분할할 때 사용하세요.

홈랩 VLAN 분할란 무엇인가요?

이 스킬은 홈 네트워크를 여러 개의 VLAN(가상 LAN)으로 분할하여 IoT 장치, 게스트, 그리고 메인 PC가 서로 통신하지 못하도록 격리하는 방법을 제공합니다. 이것은 홈 네트워크 보안을 강화하는 가장 효과적인 업그레이드입니다. UniFi, pfSense/OPNsense, MikroTik 등 주요 홈랩 네트워크 플랫폼을 모두 지원하며, VLAN 생성부터 DHCP 설정, 방화벽 규칙 적용, SSID-매핑까지 단계별로 설명합니다. 특히 각 VLAN 간의 기본적인 라우팅을 차단하는 방화벽 규칙과, 예외가 필요한 서비스(DNS, Home Assistant 등)에 대한 허용 규칙을 구체적으로 제시합니다. 또한 VLAN을 처음 설정하는 사람도 이해할 수 있도록 평평한 네트워크와 VLAN의 차이점을 그림으로 설명하고, 잘못된 설정 사례(안티패턴)와 모범 사례를 함께 제공하여 실수를 방지하도록 돕습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/homelab-vlan-segmentation

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

홈랩 VLAN 분할은(는) 무엇을 하나요?

홈 네트워크를 격리된 VLAN으로 분할하여 IoT 장치, 게스트, 메인 PC가 서로 통신하지 못하도록 하는 방법입니다. 홈 네트워크의 가장 강력한 보안 업그레이드입니다.

여기에 제시된 모든 방화벽 규칙은 세그먼트 간 격리를 추가하는 것입니다. 기존 보호 조치를 제거하지 않습니다. 변경 사항은 유지보수 시간에 적용하고, 각 단계 후 세그먼트 간 연결성을 확인한 후 다음 단계로 넘어가세요.

사용 시기

  • 처음으로 홈 네트워크에 VLAN 설정하기
  • IoT 장치(스마트 전구, 카메라, TV)를 신뢰 장치와 격리하기
  • 집 장치에 접근할 수 없는 게스트 Wi-Fi 네트워크 만들기
  • VLAN 개념을 모르는 사람에게 설명하기
  • 트렁크 포트, 액세스 포트, SSID-to-VLAN 매핑 구성하기
  • pfSense/OPNsense/UniFi에서 VLAN 간 라우팅 또는 방화벽 규칙 문제 해결하기

작동 방식

VLAN 없음 — 평평한 네트워크:
  모든 장치가 192.168.1.0/24에 있음
  스마트 TV(잠재적 멀웨어) → NAS, PC, 모든 것에 접근 가능

VLAN 사용:
  VLAN 10 — Trusted    192.168.10.0/24  (PC, 휴대폰, 노트북)
  VLAN 20 — IoT        192.168.20.0/24  (스마트 TV, 전구, 카메라)
  VLAN 30 — Servers    192.168.30.0/24  (NAS, 파이, 가상 머신)
  VLAN 40 — Guest      192.168.40.0/24  (방문자 Wi-Fi)
  VLAN 99 — Management 192.168.99.0/24  (스위치/AP 웹 UI)

  스마트 TV → 192.168.10.0/24 및 192.168.30.0/24로의 접근 차단
  게스트 → 인터넷만 가능, 집 장치 전혀 볼 수 없음

VLAN 디자인 템플릿

VLAN  이름        서브넷              게이트웨이         용도
10    trusted     192.168.10.0/24     192.168.10.1    PC, 휴대폰, 노트북
20    iot         192.168.20.0/24     192.168.20.1    스마트 홈 장치
30    servers     192.168.30.0/24     192.168.30.1    NAS, 파이, 자체 호스팅
40    guest       192.168.40.0/24     192.168.40.1    방문자 Wi-Fi
99    management  192.168.99.0/24     192.168.99.1    네트워크 장비 웹 UI

예시

UniFi AP 및 관리형 스위치가 있는 일반적인 홈랩:

시나리오: 3 bedroom 집, UniFi Dream Machine + UniFi 8 포트 스위치 + 2 AP

VLAN 10 — Trusted    192.168.10.0/24   MacBook, iPhones, iPad
VLAN 20 — IoT        192.168.20.0/24   Nest 온도조절기, Philips Hue, Ring 초인종, 스마트 TV
VLAN 30 — Servers    192.168.30.0/24   Synology NAS (192.168.30.10), Pi-hole (192.168.30.2)
VLAN 40 — Guest      192.168.40.0/24   방문자 Wi-Fi — 인터넷만

SSID → VLAN 매핑:
  "Home"      → VLAN 10 (WPA2, 강력한 비밀번호, 신뢰 장치만)
  "IoT"       → VLAN 20 (WPA2, 별도 비밀번호, 설정을 위해 라우터에 인쇄)
  "Guest"     → VLAN 40 (WPA2, 자유롭게 공유할 수 있는 간단한 비밀번호)

스위치 포트 동작:
  Port 1  → 트렁크 to 라우터 (태그된 VLANs 10,20,30,40,99)
  Port 2  → 트렁크 to APs (태그된 VLANs 10,20,40; AP가 SSID별 태깅 처리)
  Port 3  → 액세스 VLAN 30 (NAS — 언태그, VLAN 인식 불필요)
  Port 4  → 액세스 VLAN 30 (Pi-hole — 언태그)
  Port 5–8 → 액세스 VLAN 10 (유선 워크스테이션)

방화벽 규칙 적용 (모든 규칙은 격리를 추가하며, 기존 보호를 제거하지 않음):
  IoT → Trusted: 차단
  IoT → Servers: 192.168.30.2:53 (Pi-hole DNS 허용) 제외 모두 차단
  IoT → Internet: 허용
  Guest → 로컬 네트워크: 차단
  Guest → Internet: 허용
  Trusted → 모든 곳: 허용

UniFi 설정

UniFi Controller에서 네트워크 만들기

Settings → Networks → Create New Network

각 VLAN에 대해:
  Name: IoT
  Purpose: Corporate  (DHCP + 라우팅 제공)
  VLAN ID: 20
  Network: 192.168.20.0/24
  Gateway IP: 192.168.20.1
  DHCP: Enable
  DHCP Range: 192.168.20.100 – 192.168.20.254

SSID를 VLAN에 매핑 (UniFi)

Settings → WiFi → Create New WiFi

  Name: IoT-Network
  Password: <별도 비밀번호>
  Network: IoT  ← 여기서 VLAN 선택
  # 이 SSID에 연결하는 모든 장치는 VLAN 20에 배치됨

  Name: Guest
  Password: <게스트 비밀번호>
  Network: Guest
  Guest Policy: Enable  ← 게스트 간 격리도 수행

UniFi 방화벽 규칙 (트래픽 규칙)

Settings → Traffic & Security → Traffic Rules

# IoT가 Trusted VLAN에 도달하지 못하게 차단
  Action: Block
  Category: Local Network
  Source: IoT (192.168.20.0/24)
  Destination: Trusted (192.168.10.0/24)

# IoT가 인터넷에만 접근 허용
  Action: Allow
  Source: IoT
  Destination: Internet

# Guest가 모든 로컬 네트워크에 접근 차단
  Action: Block
  Source: Guest
  Destination: Local Networks

pfSense / OPNsense 설정

VLAN 만들기

Interfaces → Assignments → VLANs → Add

  Parent Interface: em1  (LAN NIC)
  VLAN Tag: 20
  Description: IoT

# 각 VLAN에 대해 반복한 후, 각 VLAN을 인터페이스에 할당:
Interfaces → Assignments → Add
  생성한 VLAN 선택 → 클릭 Add
  인터페이스 활성화, IP를 게이트웨이 주소로 설정 (192.168.20.1/24)

각 VLAN에 대한 DHCP

Services → DHCP Server → VLAN 인터페이스 선택

  Enable DHCP
  Range: 192.168.20.100 to 192.168.20.254
  DNS Servers: 192.168.30.2  ← Pi-hole IP (있는 경우)

방화벽 규칙 (pfSense/OPNsense)

# 규칙은 위에서 아래로 처리되며, 첫 번째 일치가 우선합니다.

# IoT 인터페이스 (VLAN 20)에서:
  규칙 1: IoT → Pi-hole DNS 허용  ← RFC1918 차단 규칙보다 먼저 와야 함
    프로토콜: UDP/TCP
    출처: IoT net
    목적지: 192.168.30.2 port 53
    액션: Allow

  규칙 2: IoT → RFC1918 (모든 개인 IP 범위) 차단
    프로토콜: any
    출처: IoT net
    목적지: RFC1918  (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12)
    액션: Block

  규칙 3: IoT → 인터넷 허용
    프로토콜: any
    출처: IoT net
    목적지: any
    액션: Allow

# Trusted 인터페이스 (VLAN 10)에서:
  모든 허용 (신뢰 장치는 모든 것에 접근 가능)
    출처: Trusted net
    목적지: any
    액션: Allow

# 특정 로컬 서비스가 필요한 IoT 장치를 위한 추가 예외:
  규칙 2 (RFC1918 차단) 앞에 삽입:
    프로토콜: TCP
    출처: IoT net
    목적지: 192.168.30.x port 8123  ← Home Assistant
    액션: Allow

MikroTik 설정

# 1단계: VLAN 필터링이 활성화된 브리지 생성
/interface bridge
add name=bridge vlan-filtering=yes

# 2단계: 물리적 포트를 브리지에 추가
# 트렁크 포트 to 라우터/업링크 (모든 VLAN에 태그)
/interface bridge port
add bridge=bridge interface=ether1 frame-types=admit-only-vlan-tagged

# 신뢰 장치용 액세스 포트 (언태그 VLAN 10)
/interface bridge port
add bridge=bridge interface=ether2 pvid=10 frame-types=admit-only-untagged-and-priority-tagged

# IoT 장치용 액세스 포트 (언태그 VLAN 20)
/interface bridge port
add bridge=bridge interface=ether3 pvid=20 frame-types=admit-only-untagged-and-priority-tagged

# 3단계: 각 포트에 허용되는 VLAN 정의
/interface bridge vlan
add bridge=bridge tagged=ether1 untagged=ether2 vlan-ids=10
add bridge=bridge tagged=ether1 untagged=ether3 vlan-ids=20

# 4단계: 브리지에 VLAN 인터페이스 생성 (게이트웨이 IP)
/interface vlan
add interface=bridge name=vlan10 vlan-id=10
add interface=bridge name=vlan20 vlan-id=20

# 5단계: 게이트웨이 IP 할당
/ip address
add interface=vlan10 address=192.168.10.1/24
add interface=vlan20 address=192.168.20.1/24

# 6단계: DHCP 풀 및 서버
/ip pool
add name=pool-trusted ranges=192.168.10.100-192.168.10.254
add name=pool-iot ranges=192.168.20.100-192.168.20.254

/ip dhcp-server
add interface=vlan10 address-pool=pool-trusted name=dhcp-trusted
add interface=vlan20 address-pool=pool-iot name=dhcp-iot

/ip dhcp-server network
add address=192.168.10.0/24 gateway=192.168.10.1
add address=192.168.20.0/24 gateway=192.168.20.1

# 7단계: 방화벽 — IoT가 Trusted VLAN에 도달하지 못하게 차단
/ip firewall filter
add chain=forward src-address=192.168.20.0/24 dst-address=192.168.10.0/24 \
    action=drop comment="IoT에서 Trusted로 차단"

스위치 트렁크 vs 액세스 포트

# 트렁크 포트: 여러 VLAN을 전달 (태그됨) — 스위치-스위치, 스위치-라우터, 스위치-AP 연결
# 액세스 포트: 하나의 VLAN을 전달 (언태그) — 최종 장치(PC, 카메라, NAS) 연결

# 라우터에 연결된 관리형 스위치 포트는 트렁크여야 함:
  허용 VLAN: 10, 20, 30, 40, 99

# PC에 연결되는 포트는 액세스 포트여야 함:
  VLAN: 10 (trusted)
  태깅 없음 — PC는 VLAN을 알거나 신경 쓰지 않음

# AP에 연결되는 포트는 트렁크여야 함:
  AP가 각 SSID의 트래픽을 올바른 VLAN ID로 태그함
  허용 VLAN: 10, 20, 40  (AP가 서비스하는 SSID들)

안티패턴

# 나쁨: 방화벽 규칙 없이 VLAN 생성
# 방화벽 규칙이 없는 VLAN은 보안을 제공하지 않음 — VLAN 간 라우팅은 기본적으로 열려 있음
# 좋음: VLAN 생성 직후 명시적 차단 규칙 추가

# 나쁨: Pi-hole을 IoT VLAN에 배치
# IoT 장치는 접근 가능하지만, 신뢰 장치는 (추가 규칙 없이) 접근 불가
# 좋음: Pi-hole을 Servers VLAN에 배치하고 모든 VLAN이 포트 53에 접근하도록 규칙 추가

# 나쁨: 네이티브 VLAN이 관리 VLAN과 동일
# 언태그 트래픽이 관리 VLAN에 유입되면 VLAN 호핑 공격 가능
# 좋음: 전용 미사용 VLAN을 네이티브로 사용 (예: VLAN 999), 관리 트래픽은 태그로 유지

# 나쁨: IoT SSID와 신뢰 SSID의 Wi-Fi 비밀번호 동일
# 비밀번호를 알게 된 사람이 IoT 장치를 잘못된 세그먼트에 연결 가능

모범 사례

  • 4개의 VLAN으로 시작: Trusted, IoT, Servers, Guest — 필요에 따라 추가
  • Pi-hole을 Servers VLAN에 배치 (192.168.30.x)
  • 모든 VLAN에서 Pi-hole IP로 DNS(포트 53)를 허용하는 방화벽 규칙을 RFC1918 차단 규칙보다 먼저 추가
  • 규칙 변경 후 격리 테스트: IoT VLAN에서 신뢰 장치로 ping 시도 — 실패해야 함
  • 스위치 및 AP 웹 UI용 관리 VLAN을 사용하고 Trusted VLAN만 접근 가능하도록 제한
  • VLAN 디자인을 표로 문서화 (VLAN ID, 이름, 서브넷, 용도)

관련 스킬

  • homelab-network-setup
  • homelab-pihole-dns
  • homelab-wireguard-vpn

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

관련 스킬