Cloudflare WARP is an overlay network just like ZeroTier and Tailscale but instead of peer-to-peer, you connect to the nearest Cloudflare PoP using WireGuard.
Finally, a free site-to-site VPN from Cloudflare.
Because Cloudflare WARP uses WireGuard, we can run Cloudflare WARP Connector on MikroTik.
Cloudflare Zero Trust settings
Cloudflare WARP-to-WARP
- Go to Settings, and then Network.
- Enable Proxy.
- Check UDP and ICMP.
- Enable Allow WARP to WARP connection.
Let Cloudflare assign the WARP-to-WARP IPv4 range to devices
Instead of getting the same IP address of 172.16.0.2
to every device, we instead enable “Override local interface IP” so that devices get their own unique IP from 100.96.0.0/12
.
- Go to Settings, and then WARP Client.
- Enable Override local interface IP.
Configure Split Tunneling
This allows Cloudflare WARP-to-WARP traffic to pass though the WireGuard instead of getting handled as local traffic.
- Go to Settings, and then WARP Client.
- Click “Default” profile, and then click Edit.
- Make sure split tunnels is set to Exclude IPs and domains.
- Click “Manage” on Split Tunnels.
- Remove IP range
100.64.0.0/10
andfd00::/8
.
Create WARP Connector tunnel
- Go to Networks, and then Tunnels.
- Click Create a tunnel.
- Select WARP Connector.
- Make sure all prerequisites are enabled, and then next step.
- Name your tunnel, and then Create tunnel.
- Copy the WARP Connector token at step 3 that starts with
eyJhIjoi
, and then click next step. - Click Return to Tunnels.
Assign your private IP range to routes
For example, your MikroTik is in IP range 192.168.1.0/24
and you want other devices in your Cloudflare WARP site-to-site VPN to access all devices under 192.168.1.0/24
.
- Go to Networks, and then Routes.
- Click Create route.
- Input your MikroTik’s IP range in CIDR, like
192.168.1.0/24
. - Select your WARP Connector tunnel name in Tunnel.
- Click Create.
Generate Cloudflare WARP Connector WireGuard configuration
- Open a terminal with Docker installed. It is recommended to use GitHub Codespaces if you have a GitHub account.
- Using wgcf-connector, enter this command in terminal, replacing
<token>
with the token you copied earlier that starts witheyJhIjoi
.
|
|
The program will output a file wgcf-connector-<registration_id>.conf in your current working directory with contents like this:
|
|
Setup MikroTik Cloudflare WARP WireGuard
- Add a new WireGuard interface.
/interface wireguard add mtu=1420 name=Cloudflare-WARP private-key="your_private_key"
- Add WireGuard peer to connect to Cloudflare WARP. For Zero Trust,
162.159.193.1
should be the endpoint to reduce latency.1 Persistent keepalive is enabled so that the tunnel will not timeout when not in use./interface wireguard peers add allowed-address=0.0.0.0/0,::/0 endpoint-address=162.159.193.1 endpoint-port=2408 interface=Cloudflare-WARP name=Cloudflare-PoP persistent-keepalive=1m public-key="bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo="
Setup IPv4
- Add Cloudflare WARP’s IPv4 address to the WireGuard interface.
/ip address add address=100.96.0.1/12 interface=Cloudflare-WARP
- Enable NAT44. The
to-address
should be set to the IPv4 address of the WireGuard interface./ip firewall nat add action=src-nat chain=srcnat dst-address=!100.96.0.0/12 out-interface=Cloudflare-WARP to-addresses=100.96.0.1
Setup IPv6
If you already have native IPv6, you probably don’t need to set this up. If you don’t have native IPv6, this allows you to get IPv6 connectivity to your devices.
Cloudflare WARP Connector does not support site-to-site IPv6, so IPv6 port forwarding is needed.
It is recommended to just set a static IPv6 address to every device that needs IPv6 port forwarding instead of relying on SLAAC so that the IPv6 address for port forwarding does not change.
- Add Cloudflare WARP’s IPv6 address to the WireGuard interface.
/ipv6 address add address=2606:4700:110:8ced:11b5:d064:abc:ee89/128 interface=Cloudflare-WARP
- Add IPv6 ULA to your LAN interface. Make sure the prefix you chose does not conflict with the Cloudflare WARP-to-WARP IPv6 range.
/ipv6 address add address=fd00:1234:5678:9abc::/64 advertise=no interface=bridge
- Enable NAT66. Yes, I know NAT is bad, awful when we are talking about IPv6, but since Cloudflare WARP only provides a single IPv6 address, it’s necessary to use NAT in IPv6. The
to-address
should be set to the IPv6 address of the WireGuard interface./ipv6 firewall nat add action=src-nat chain=srcnat out-interface=Cloudflare-WARP to-address=2606:4700:110:8b7b:2edb:5201:dddd:19fd/128
- Add an IPv6 route. If you have native IPv6 connectivity, use Cloudflare WARP-to-WARP IPv6 range
fd00::/8
, if you don’t have native IPv6, use::/0
./ipv6 route add dst-address=::/0 gateway=Cloudflare-WARP
- Allow the IPv6 firewall to accept packets that are port forwarded. (Optional if you want to port forward on IPv6.)
/ipv6 firewall filter set [find action=drop chain=forward in-interface-list="!LAN"] comment="defconf: drop everything else not coming from LAN not DSTNATed" connection-nat-state=!dstnat
IPv6 port forwarding example
The dst-address
should be set to the IPv6 address of the WireGuard interface.
To port forward TCP port 8080
of fd00:1234:5678:9abc::1
:
|
|
Test site-to-site VPN
On your device outside your LAN
- Download Cloudflare WARP on your device.
- Login to Cloudflare Zero Trust.
- Turn on Cloudflare Zero Trust.
- Try to ping and access the server that is on the MikroTik’s IP range.