WireGuard wg-quick CLI 치트시트: VPN 기동 및 라우팅

💡 핵심 요약 (Executive Summary)

본 가이드는 network vpn wg wg quick 핵심 가이드 및 실전 아키텍처의 핵심 개념, 실전 구성 명령어 및 아키텍처 베스트 프랙티스를 다룹니다. 클라우드 네이티브 및 인프라 엔지니어링 실무에 즉시 활용 가능하도록 체계적으로 정리했습니다.

📑 Table of Contents
Exec
클라이언트 터널링 인터페이스 생성 (Mac OS)
bash
my_interface=fredric18
# config 생성
my_config="""
"""
cat <<EOF > /opt/homebrew/etc/wireguard/$my_interface.conf
$my_config
EOF

wg-quick up $my_interface

# 무슨소용인질 모르겠음
wg-quick save $my_interface
연결
bash
my_interface=fredric18
wg-quick up $my_interface
연결 종료
bash
my_interface=fredric18
wg-quick down $my_interface
상태 확인
Trouble Shooting
Mac OS Issue
txt
wg-quick: Version mismatch: bash 3 detected, when bash 4+ required
문제 개요
bash
# mac에서 bash버전문제 발생시
bash --version
>>>
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)
Copyright (C) 2007 Free Software Foundation, Inc.
<<<

brew upgrade bash
>>>
Warning: bash 5.3.8 already installed
<<<

wg-quick
>>>
wg-quick: Version mismatch: bash 3 detected, when bash 4+ required
<<<

/opt/homebrew/bin/bash --version
>>>
GNU bash, 버전 5.3.8(1)-release (aarch64-apple-darwin23.6.0)
Copyright (C) 2025 Free Software Foundation, Inc.
라이선스 GPLv3+: GNU GPL 버전 3 이상 <http://gnu.org/license/gpl.html>

이 프로그램은 자유 소프트웨어입니다. 자유롭게 바꾸고 재배포할 수 있습니다.
법률이 허용하는 모든 범위내의 보증은 없습니다.
<<<

which bash
>>>
/bin/bash
<<<

echo $PATH
>>>
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myeong/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/Users/myeong/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/myeong/.cargo/bin:/Applications/iTerm.app/Contents/Resources/utilities
<<<
  • solved
Reference & Guidelines (NOTE)

PATH의 경로중 동일한 이름의 바이너리가 존재할 경우, 변수내 가장 왼쪽이 우선적으로 처리된다.

bash
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
  source ~/.zshrc
  bash --version
  >>>
  GNU bash, 버전 5.3.8(1)-release (aarch64-apple-darwin23.6.0)
  Copyright (C) 2025 Free Software Foundation, Inc.
  라이선스 GPLv3+: GNU GPL 버전 3 이상 <http://gnu.org/license/gpl.html>

  이 프로그램은 자유 소프트웨어입니다. 자유롭게 바꾸고 재배포할 수 있습니다.
  법률이 허용하는 모든 범위내의 보증은 없습니다.
Client 하드웨어 종속적 이슈
  • – client config

    txt
    [Interface]
      PrivateKey = <secret>
      Address = 10.0.X.X/32
      DNS = 192.168.118.53
    
      [Peer]
      PublicKey = <secret>
      AllowedIPs = 0.0.0.0/0, ::/0
      Endpoint = <WAN>:41821
      PersistentKeepalive = 25

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *