Skip to content

Instantly share code, notes, and snippets.

@jesgeerts
Created September 3, 2018 10:54
Show Gist options
  • Save jesgeerts/c5e0e4cc9a83f33303c7c75511a38ac2 to your computer and use it in GitHub Desktop.
Save jesgeerts/c5e0e4cc9a83f33303c7c75511a38ac2 to your computer and use it in GitHub Desktop.
auto vmbr2
iface vmbr2 inet static
address 10.0.0.254
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.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3389 -j DNAT --to 10.0.0.2:3389
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 3389 -j DNAT --to 10.0.0.2:3389
# post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 3389 -j DNAT --to 10.0.0.2:3389
# is able to portforward the port 3389 for the VM with the IP 10.0.0.2
# Assign the VM's with their own IP manually or use a DHCP server on the PVE node
@jesgeerts
Copy link
Author

For the DHCP server on the node there is aditional configuration required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment