[Hetzner Cloud] Proxmox LXC Contrainer Traffic to OPNSense?

uncre4tive

New Member
Dec 28, 2024
1
0
1
Hello everyone,

I am new to networking and routing.
I have created two 2 servers (OPNSense and Proxmox Host) and a private cloud network (192.168.179.0/24) in the Hetzner Cloud.

OPNSense:
WAN: Public IP address
LAN: Private Cloud IP (192.168.179.2)

Promox host:
Network adapter(enp1s0): Public IP address
Network adapter(enp7s0): Private Cloud IP (192.168.179.3)
Network Config(/etc/network/interfaces):
Code:
auto lo
iface lo inet loopback

auto enp1s0
iface enp1s0 inet static
        address <PUBLIC-IP>/32
        gateway 172.31.1.1
        pointopoint 172.31.1.1
        dns-nameservers 185.12.64.1 185.12.64.2
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -F
        post-up iptables -t nat -A POSTROUTING -s '192.168.179.0/24' -o enp7s0 -j MASQUERADE

auto enp7s0
iface enp7s0 inet dhcp
        post-up ip route add default via 192.168.179.1
        dns-nameservers 192.168.179.2

Private cloud network:
private_cloud_network.png

The connection between the Proxmox host and OPNSense is working properly. All traffic from network 192.168.179.0/24 is routed via the OPNSense.

How can I also route the Proxmox VMs(LXC) via the OPNSense?
Can I use the private cloud network(192.168.179.0/24)?

Thanks for helping!
 
I have just spent a better part of a day to get this to work. So what I wanted to do is port forward from opnsense WAN to LAN (proxmox via vswitch) and then route this to a VM with WireGuard. I got it to send the packet but outgoing packets would not know where to go because the proxmox server also has a WAN interface.

The route is like this:

WAN -> LAN -> vSwitch -> Proxmox -> Wireguard VM
And back:
WireGuard VM -> Proxmox -> ??? (the packet originates from the VM and with a WAN IP as dest)

I'm about to give up...:/
 
Last edited: