The cluster VPN created by Kilo can also be used by peers as a gateway to access the Internet. In order configure a local machine to use the cluster VPN as a gateway to the Internet, first register the local machine as a peer of the cluster following the steps in the VPN docs.
Once the machine is registered, generate the configuration for the local peer:
Next, the WireGuard configuration must be modified to enable routing traffic for any IP via a node in the cluster.
To do so, open the WireGuard configuration in an editor, select a node in the cluster, and set the
AllowedIPs field of that node's corresponding
peer section to
The configuration should now look something like:
The configuration can then be applied to the local WireGuard interface, e.g.
Next, add routes for the public IPs of the WireGuard peers to ensure that the packets encapsulated by WireGuard are sent through a real interface:
Finally, the local machine can be configured to use the WireGuard interface as the device for the default route:
The local machine is now using the selected node as its Internet gateway and the connection can be verified. For example, try finding the local machine's external IP address: