So, hello again!
Currently I have four dedicated machines, they are not connected via cable or anything like that, but sometimes I do need for containers in different machines to communicate between them.
What I’m currently doing right now is communicating over the machine’s public IP address and port forwarding + adding a IP filter. And while this works… it is not secure, maintenance is a hassle because if I change the VM/LXC container to another machine I need to update every single application that was connecting to the app (because their IP changed) VM live migrations is impossible due to the public IP changing, and other issues.
So what I thought is hosting a VPN (with Wireguard) and connecting all the containers to my VPN, which that would technically allow me to have a “private” LAN over a VPN, and because Wireguard allows you to specify what IPs are going to go over the VPN (example: only IPs in the 192.168.0.1/16
subnet will be routed via the VPN) I wouldn’t need to worry about routing unnecessary traffic via the VPN (example: I don’t need to route a http request to Google over the VPN, but anything that is related to my containers should), yay! …but how could I do that?
While I was able to create a VPN between two VMs (and it worked fine, Wireguard is very easy to use :)), I didn’t want to setup Wireguard on every single VM/LXC container just to have a VPN connection to my “private LAN”…
What I tried doing is hosting Wireguard on the Proxmox host itself (I know… bad idea, but it was just to see what would happen) and adding the interface to the /etc/network/interfaces
… but well, using wg0
as the interface name just causes Proxmox to not recognize the interface and doesn’t allow you to use it, using vmbr1
causes error on LXC container/VM startup.
I think it is possible (why wouldn’t it be? after all, you can do this manually by setting up client connections inside of the VM/container) but I can’t find any tutorial explaning how to do it (most of the threads are about OpenVPN, and sadly none of them has at least an example on how to do it). Most of the threads that I found related to this are people talking about routing all the cluster network via a VPN (which I don’t want) or hosting a VPN inside of a VM/LXC container (again, not really what I want to do).
tl;dr: Is it possible to create a private LAN between multiple machines with Wireguard in Proxmox without needing to configure Wireguard on every single VM/LXC container (allowing you to configure interfaces/IPs directly on the Proxmox interface)? If yes, how do you setup that?