I have setup a wireguard interface for my IncusOS host (using incus admin os system network edit) and am now trying to 1) expose VMs to the wireguard network and 2) route all egress traffic through wireguard.
I believe, that 1) should be easily doable with proxies or network forwards, but I have no good idea how to solve 2).
I had thought about creating a bridge network that provides NAT on the wireguard interface - but I don’t really understand incus’s bnetworks well enough to know where to start.
So far I have not yet dared to look into OVN networking - if possible I’d like to solve this with bridge networking, but if not, I’m willing to take that step.
Here’s the configuration for my wireguard interface:
If you change the default route out to be the wireguard interface, then all traffic should go through there. And then you can probably use an ACL to prevent any traffic from getting to the local network that the main real NIC is connected to.
It should be something like this:
routes:
- to: 0.0.0.0/0
via: 10.234.100.1
# [...]
The other VPN endpoint will need to be able to act as a default route, that is, it will need to have ip forwarding enabled and allowed through it’s firewalls.
Do you mean to set the route on the wireguard interface? I tried that, but the route doesn’t seem to be used (tested with checking the public IP from a container: dig +short -4 @resolver1.opendns.com a myip.opendns.com), which makes sense, because at that point I should have two routes for 0.0.0.0/0, one on the physical interface eth0 and one on the wireguard interface. Do I need to set route metrics manually?
As for 1 - the wireguard (point-to-point) routing works already. My plan was to simply forward traffic from the wireguard interface to containers, but I think I should be able to do that with proxy devices (so, different ports per instance). However, point-to-site routing looks even better, I’ll look into that.
There really is no easy way to get a shell on the IncusOS afaik. Unless you know a way to get it (apart from booting without TPM which I can’t do on that production server).