본문 바로가기
Q&A2024년 4월 6일1분 읽기

WireGuard VPN 직접 구축하기

최
최유진
조회 923댓글 1

WireGuard로 개인 VPN 서버를 직접 만드는 방법을 알려주세요.

댓글 1

김김영삼2년 전

WireGuard VPN 서버 구축:

# 서버 설치
sudo apt install wireguard

# 키 생성
wg genkey | tee server_private | wg pubkey > server_public
wg genkey | tee client_private | wg pubkey > client_public

# 서버 설정 /etc/wireguard/wg0.conf
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey =
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey =
AllowedIPs = 10.0.0.2/32

# 시작
sudo wg-quick up wg0
sudo systemctl enable wg-quick@wg0

OpenVPN보다 빠르고 설정이 간단합니다. 코드도 4,000줄밖에 안 되어 보안 감사가 쉽습니다.

Ctrl+Enter로 등록