Masquerade ip forward for Proxmox on hetzner (single IP)

This works for me:

  • Install plain debian 11, install proxmox
  • Screenshot IPs of interface
  • Clear all IP data from existing/default interface
  • Create Linux bridge with IP info

Then open SSH and edit /etc/network/interfaces:


auto vmbr1
iface vmbr1 inet static
    address 10.0.101.2
    netmask 255.255.255.0
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up   iptables -t nat -A POSTROUTING -s '10.0.101.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '10.0.101.0/24' -o vmbr0 -j MASQUERADE
    post-up   iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 10.0.101.5:22
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 10.0.101.5:22

Then when creating a container:

All traffic is routed properly out of br1 to br0 (world).

I can connect to this host on :2222.