1. 安装wireguard:
sudo apt-get install wireguard
  1. 创建配置文件:
sudo nano /etc/wireguard/wg0.conf
  1. 编辑配置文件:
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <Your Private Key>

[Peer]
PublicKey = <Peer's Public Key>
AllowedIPs = 10.0.0.2/32
Endpoint = <Peer's IP Address>:51820
  1. 启动wireguard:
sudo wg-quick up wg0
  1. 检查wireguard状态:
sudo wg show