WireGuard VPN 搭建详解

前言

WireGuard 是新一代 VPN 协议,性能超越 OpenVPN,配置更简单。

一、WireGuard 优势

  • 代码量少,易于审计
  • 连接速度快,延迟低
  • 配置简单,安全性高

二、服务器端安装

apt install wireguard
wg genkey | tee privatekey | wg pubkey > publickey

三、服务器配置

[Interface]
Address = 10.0.0.1/24
PrivateKey = 服务器私钥
ListenPort = 51820

[Peer]
PublicKey = 客户端公钥
AllowedIPs = 10.0.0.2/32

四、客户端配置

[Interface]
Address = 10.0.0.2/24
PrivateKey = 客户端私钥

[Peer]
PublicKey = 服务器公钥
Endpoint = 服务器 IP:51820
AllowedIPs = 0.0.0.0/0

五、启用并测试

wg-quick up wg0
wg show

总结

WireGuard 配置简单,性能优秀,是搭建个人 VPN 的首选方案。

上一篇 开源软件的商业化困境与出路