Raspberry Pi를 사용한 홈 라우터

발행: (2025년 12월 25일 오후 11:59 GMT+9)
2 분 소요
원문: Dev.to

Source: Dev.to

사전 요구 사항

  • Debian Bookworm(이후 버전) 기반 Raspberry Pi OS
  • Ethernet 포트(eth0)를 통한 정상적인 인터넷 연결
  • NetworkManager가 네트워크 연결을 관리하도록 설정
  • eth0가 올바르게 구성됨

이더넷 연결 확인

sudo nmcli device

eth0connected 상태인지 확인합니다.

Wi‑Fi 액세스 포인트 만들기

Note: wlan0을 무선 인터페이스 이름으로 교체하세요.

# Add a new Wi‑Fi connection
sudo nmcli connection add type wifi \
  ifname wlan0 \
  con-name ap0 \
  ssid "" \
  autoconnect yes

# Set the interface to access‑point mode
sudo nmcli connection modify ap0 \
  802-11-wireless.mode ap

# Use the 2.4 GHz band
sudo nmcli connection modify ap0 \
  802-11-wireless.band bg

# Configure WPA2/WPA3 pre‑shared key
sudo nmcli connection modify ap0 \
  wifi-sec.key-mgmt wpa-psk \
  wifi-sec.psk ""

NetworkManager 공유 모드 활성화

NetworkManager의 공유 모드는 다음을 수행합니다:

  • Wi‑Fi 인터페이스에 DHCP 서버 시작
  • IP 포워딩 활성화
  • IP 마스커레이딩(NAT) 적용
# Enable shared mode (IPv4)
sudo nmcli connection modify ap0 \
  ipv4.method shared

# Specify the IPv4 subnet for the AP
sudo nmcli connection modify ap0 \
  ipv4.addresses 172.18.0.1/24

# (Optional) Disable IPv6
sudo nmcli connection modify ap0 \
  ipv6.method ignore

# Bring the access point up
sudo nmcli connection up ap0

설정 확인

# Show the IP address assigned to the Wi‑Fi interface
ip -4 addr show wlan0

# Display routing table
# Expected:
# - 172.18.0.0/24 via wlan0
# - default route via eth0
ip -4 route

# List connected stations (Layer 2)
sudo iw dev wlan0 station dump

# List connected devices at the IP layer (Layer 3)
ip neigh show dev wlan0

참고 자료

Back to Blog

관련 글

더 보기 »