安装:
apt install wireguard
生成pricatekey publickey
wg genkey | tee privatekey | wg pubkey > publickey
a机
[Interface]
Address = 192.168.22.1/24, 2a0f:7803:f851::77:8848/64
PrivateKey =
ListenPort = xxxx
# BEGIN_PEER
[Peer]
PublicKey =
AllowedIPs = 192.168.22.2/32, 2a0f:7803:f851::77:721/128
Endpoint = xxxx:xxxx
# END_PEER
b机
[Interface]
Address = 192.168.22.2/24, 2a0f:7803:f851::77:721/64
DNS = 1.1.1.1, 1.0.0.1
ListenPort = xxxx
PrivateKey =
[Peer]
PublicKey =
AllowedIPs = 192.168.22.1/24,::/0
Endpoint = xxxx:xxxx
PersistentKeepalive = 25
Comments | NOTHING