Connect VMs to VPN

olega

New Member
Jan 21, 2024
1
0
1
Hi, I'm new to Proxmox and still trying to figure everything out.
I'm currently looking for possibilities on connecting my VMs to VPN.
I created LXC and configured l2tp VPN connection there using network manager. It works fine and I'm able to access devices on my external network when I'm inside the container.
Here is output ip a from the container

Code:
root@CT123:~# nmcli conn up lviv
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
root@CT123:~# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: eth0@if63: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether bc:24:11:9b:01:3d brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.216/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 39793sec preferred_lft 39793sec
    inet 192.168.1.218/24 brd 192.168.1.255 scope global secondary dynamic noprefixroute eth0
       valid_lft 39791sec preferred_lft 39791sec
    inet6 fdb1:2aad:28c0:524b:93fc:ec9a:df61:490e/64 scope global dynamic noprefixroute
       valid_lft 1736sec preferred_lft 1736sec
    inet6 fe80::8fd5:63aa:6a1:2900/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast state UNKNOWN group default qlen 3
    link/ppp
    inet 192.168.2.220 peer 10.255.255.0/32 scope global ppp0
       valid_lft forever preferred_lft forever


What I would like to achieve now is to expose this VPN connection to other VMs.
Ideally, I would like that by default all traffic goes to internet/local network and only requests to 192.168.2.x are routed through VPN.

I'm thinking I need to create a new network interface and expose it to all VMs and configure routing in my LXC from this interface to VPN tunnel, but I'm unsure how to implement it.
Any ideas or pointers will be greatly appreciated!
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!