WireGuard VPN
最高效易用的VPN,远超OpenVPN。注意:不能用来翻墙,协议早就被精准识别了。
快速生成key
简单快速,一次生成公钥和私钥
wg genkey | tee private_key | wg pubkey > public_key
客户端配置文件
[Interface]
PrivateKey = 客户端私钥
Address = 客户端IP地址/32
[Peer]
PublicKey = 服务器公钥
AllowedIPs = 要访问的地址段
Endpoint = WG服务器地址:端口
服务器配置文件
[Interface]
Address = WG服务器/32
ListenPort = WG服务监听端口
PrivateKey = WG服务器私钥
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
MTU = 1420
[Peer]
PublicKey = 客户端公钥
AllowedIPs = 客户端IP地址/32
wg-quick命令行
# 启动服务
wg-quick up wg0
# 停止服务
wg-quick down wg0
客户端下载
如果没有美区apple store账号,可以从这里下载客户端应用。
Windows版本可以直接在官方下载(官方站点要梯子才能访问)。