Skip to content

Instantly share code, notes, and snippets.

@bohanyang
Last active May 13, 2024 04:47
Show Gist options
  • Save bohanyang/9cc40ff49d14b18d8dea41a7ab8de0cc to your computer and use it in GitHub Desktop.
Save bohanyang/9cc40ff49d14b18d8dea41a7ab8de0cc to your computer and use it in GitHub Desktop.
systemd-networkd WireGuard configuration of Cloudflare Wrap
[Match]
Name = wg0
[Network]
Address = 172.16.0.2/32
Address = fd01:5ca1:ab1e:8012:3456:789a:bcde:f012/128
[Route]
Gateway = 0.0.0.0
Table = 51820
[RoutingPolicyRule]
From = 172.16.0.2/32
Table = 51820
Priority = 32765
[RoutingPolicyRule]
To = 0.0.0.0/0
FirewallMark = 51820
Table = 254
Priority = 32764
[Route]
Gateway = ::
Table = 51820
[RoutingPolicyRule]
From = fd01:5ca1:ab1e:8012:3456:789a:bcde:f012/128
Table = 51820
Priority = 32765
[RoutingPolicyRule]
To = ::/0
FirewallMark = 51820
Table = 254
Priority = 32764
[Match]
Name = wg0
[Network]
Address = 172.16.0.2/32
Address = fd01:5ca1:ab1e:8012:3456:789a:bcde:f012/128
Gateway = ::
[Route]
Gateway = 0.0.0.0
Table = 51820
[RoutingPolicyRule]
From = 172.16.0.2/32
Table = 51820
Priority = 32765
[RoutingPolicyRule]
To = 0.0.0.0/0
FirewallMark = 51820
Table = 254
Priority = 32764
[Match]
Name = wg0
[Network]
Address = 172.16.0.2/32
Address = fd01:5ca1:ab1e:8012:3456:789a:bcde:f012/128
Gateway = 0.0.0.0
[Route]
Gateway = ::
Table = 51820
[RoutingPolicyRule]
From = fd01:5ca1:ab1e:8012:3456:789a:bcde:f012/128
Table = 51820
Priority = 32765
[RoutingPolicyRule]
To = ::/0
FirewallMark = 51820
Table = 254
Priority = 32764
[NetDev]
Name = wg0
Kind = wireguard
[WireGuard]
PrivateKey = gI6EdUSYvn8ugXOt8QQD6Yc+JyiZxIhp3GInSWRfWGE=
FwMark = 51820
[WireGuardPeer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/0, ::/0
#Endpoint = engage.cloudflareclient.com:2408
Endpoint = 162.159.192.1:2408
#Endpoint = [2606:4700:d0::a29f:c001]:2408
PersistentKeepalive = 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment