Set public IP for VMs in SDN

davidki

New Member
Apr 4, 2024
3
0
1
Hi there,

I have a simple sdn zone with 1 VNet and the 1 subnet (10.0.0.0/24, SNAT activated). Several vms are connected to the vnet and they have internet access and can communicate to each other.

One vm is connected to the vnet and to my default bridge (vmbr0). It has a public IP (lets say: 1.1.1.1). It is running HAProxy for accessing web applications and ssh on the upstream vms. For the management interface of proxmox I have a second ip for vmbr0 (lets say 1.1.1.2).

For lab/teaching purpose I want to use ddclient on the vms. ddclient should detect the public IP of the vms and send it to a configured DDNS provider. The problem is, that the vms in the subnet communicate over the default gateway of the host (1.1.1.2). So ddclient detects a public ip, which is not the public ip of the web applications (1.1.1.1 of the proxy vm).

Am I right, that there is no option in proxmox to change the default gateway of the subnet in the simple SDN to the ip of a vm?

What other options do you know, to route the outgoing traffic from the subnet over the public ip address of the proxy vm? A vm running router software (pfsense, opensense)? Some special SDN config like evpn?

Help would be much appreciated!
 
Hi,

if you want traffic from your subnet to go out via the proxy VM’s public IP, you can either run a router/firewall VM (like pfSense/OPNsense) and make it the gateway, or add iptables SNAT rules on the host to rewrite traffic from 10.0.0.0/24 to 1.1.1.1.
The router VM approach is cleaner for teaching, while the iptables override is the quick fix.