connecting Wireguard client to a Wireguard server with a non-fixed IP address

Consider the following scenario: You want to connect a client to a server via Wireguard – the server’s IP address changes regularly. Further you want to contact the client from the server (so not the standard use-case) – you will also have to add a keep-alive to the client config.

The keep-alive is easy, just edit the client config and add “PersistentKeepalive = 25”:

cat /etc/wireguard/wg0.conf

PrivateKey = myprivatekey
Address =

PublicKey = mypublickey
AllowedIPs =,
Endpoint =
PersistentKeepalive = 25



To connect to an endpoint with a changing IP, this is documented in the Arch Linux wiki:

You have to install wireguard-tools first to get all relevant config files to your machine.


No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *