Skip to content

Instantly share code, notes, and snippets.

Last active Jun 26, 2022
What would you like to do?

Connecting to Cloudflare WARP with WireGuard

Cloudflare's WARP VPN uses a slightly modified version of the WireGuard protocol, but it remains backwards compatible with the normal WireGuard client software. This means you can connect to it on platforms which don't yet have an official WARP client, e.g. your computer or EdgeOS-based router.

Step 1

Generate a WireGuard keypair, as usual:

wg genkey | tee private.key | wg pubkey > public.key

Step 2

Register the public half with Cloudflare, changing the fields as appropriate:

curl -d '{"key":"PASTE_PUBLIC_KEY_HERE", "install_id":"", "warp_enabled":true, "tos":"2019-09-26T00:00:00.000+01:00", "type":"Android", "locale":"en_GB"}' | tee warp.json

(tos should be the date you read and agreed to their terms of service)

Step 3

Find the tunnel endpoint:

jq '.config.peers[0]' warp.json

and the IP address for your end:

jq '.config.interface.addresses' warp.json

Step 4

Construct your WireGuard config file. It should look something like this:

Address =
ListenPort = 51820
PrivateKey = xxxxxxxxxxxxxxxxxx

PublicKey = yyyyyyyyyyyyyyyyyy
AllowedIPs =
Endpoint =


  • It seems ListenPort must not be accessible from the outside, as this appears to cause problems, so just choose any unused port and firewall it off for now
  • PrivateKey is yours from Step 1
  • PublicKey is Cloudflare's from Step 3
  • You only get one IPv4 so you'll need to use SNAT if you're doing this on a router
  • I don't know what netmask they want for IPv6 so have left that out
Copy link

glen-84 commented Jan 19, 2020

Thanks! I needed to add:


To the [Interface] section.

Copy link

p00f commented Aug 6, 2020

I get error code: 1020% when registering my public key

Copy link

rufoa commented Aug 7, 2020

I get error code: 1020% when registering my public key

@p00f try this project instead:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment