1 server, 2 clients
Install Wireguard on all machines.
$ wg genkey > server_privatekey
$ wg pubkey < server_privatekey > server_publickey_client1
$ wg pubkey < server_privatekey > server_publickey_client2
$ wg genkey | tee client1_privatekey | wg pubkey > client1_publickey
$ wg genkey | tee client2_privatekey | wg pubkey > client2_publickey
$ wg-quick up wg0
$ wg-quick down wg0
$ wg show
interface: wg0
public key: <SERVER PUBLIC KEY>
private key: (hidden)
listening port: 51820
fwmark: 0xca6c
peer: <CLIENT 1 PUBLIC KEY>
endpoint: ...
allowed ips: 10.100.0.2/32
latest handshake: 4 seconds ago
transfer: 21.11 KiB received, 38.92 KiB sent
peer: <CLIENT 2 PUBLIC KEY>
endpoint: ...
allowed ips: 10.100.0.3/32
latest handshake: 9 seconds ago
transfer: 911.10 KiB received, 2.57 MiB sent
I'm using Ubuntu 24.04 and following instructions at Install Wireguard on 24.04 I want multiple clients. So I've created a conf file for each client with different Address e.g.
My wg0.conf file has different AllowedIPs for each client:
[Interface]
Address = 10.8.0.1/24
SaveConfig = true
PostUp = ufw route allow in on wg0 out on eth0
PostUp = iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
PreDown = ufw route delete allow in on wg0 out on eth0
PreDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
PrivateKey = ***
[Peer]
PublicKey =***
AllowedIPs = 10.8.0.2/32
[Peer]
PublicKey = ***
AllowedIPs = 10.8.0.3/32
The wg-quick@wg0 service starts Ok and shows Status except that it displays:
Aug 06 13:51:43 raspberrypi systemd[1]: Finished [email protected] - WireGuard via wg-quick(8) for wg0"
Also, the wg0.conf file is changed with one of the Allowed IPs being removed!
I have tried to find a channel for WireGuards issues without success.