# gen server key
wg genkey | tee peer0.privatekey | wg pubkey > peer0.publickey
# gen user key
wg genkey | tee peer11.privatekey | wg pubkey > peer11.publickey
wg genkey | tee peer12.privatekey | wg pubkey > peer12.publickey
# wg pool 192.18.0.0/24
# server wg0 192.168.0.1 pub ip: a.b.c.d:5678
# peer11 wg0 192.168.0.11
# peer12 wg0 192.168.0.12
# peer0 /etc/wireguard/wg0.conf
[Interface]
Address = 192.18.0.1/24
SaveConfig = true
PrivateKey = <peer0-private-key>
ListenPort=5678
[Peer]
PublicKey=<peer11-pub-key>
AllowedIPs=192.18.0.11/24
Endpoint = 192.95.5.67:1234
[Peer]
PublicKey = <peer12-pub-key>
AllowedIPs = 192.18.0.12/24
Endpoint = 192.95.5.12:1234
wg-quick up wg0
# same set for peer1 and peer2
网友评论