Using a openVPN lxc container as a gateway for antother lxc container?

dtd

New Member
Aug 6, 2022
5
0
1
Hello,
I have been trying to use a openVPN lxc container as a gateway for another lxc container that runs transmission. I followed this guide to create and configure the lxc container that contains openVPN.

But instead of using the git script, I configured openVPN according to mullvad, since I am using mullvad as my vpn provider. I verified that my public IP is changed by both running curl ifconfig.me and the curl in mullvad config: curl https://am.i.mullvad.net/connected.

Next what I tried, was to change the network settings of my transmission lxc to the following:

Code:
net0: name=eth0,bridge=vmbr0,gw=**IP address to the openVPN lxc**,hwaddr=**hwaddr**,ip=**container IP**>

But my transmission container does not have any internet connection. Is this not possible? Or am I doing something wrong here?
 
In principle, this is possible.

Have you set your OpenVPN router to be router (ip forwarding on) and also enabled NAT? If not, please do that.
 
Thanks for the tip, I have not done so. Will have to try that, I am not very experienced with networking, so will have to figure it out first :D I just happened to come over an video where a dude used his LXC container as a vpn gateway/router for another lxc container. And he only explained how to set up the LXC with openVPN and then he only set the other containers gateway to the vpn containers IP, so I belived it would be that easy. But as we all know, not many youtubers go to deep into the details :P
 
so I belived it would be that easy
That part was that easy (or complicated). Forwarding the packages is normally just one command and if all other machines are set up correctly, it'll just work. If not, you have to do masquerading from one network to the other.
 
Did you ever get this working? I'm using OpenVPN with Proton running on an LXC container, I confirmed that my public IP matches what I expect and now I want to use it as a gateway for one other LXC container but it's not working.

I enabled IPv4 forwarding on the OpenVPN LXC and set its IP as the gateway for the other container, when I do that, my second container can't ping anything, I can ping my OpenVPN container and traceroute to it over 1 hop (as expected) but any traffic going outside the network just dies.