Port forwarding on Proxmox

heq

New Member
Nov 24, 2023
4
2
3
Maybe someone has experience. I have a dedicated server at OVH, but without the possibility of purchasing an additional IP (kimsufi offer).
There is any way to make VMs will have Internet access + port forward to get the VMs from Internet?

I think about pfsense as a main VM to split connection, but I am not able to configure software to work. Read some information with examples but seems to not work.
 
So, I find the solution.
For the others who will have the same problem.

/etc/network/interfaces
auto lo
iface lo inet loopback

iface eno1 inet manual

iface eno2 inet manual

auto vmbr0
iface vmbr0 inet static
address 149.XXX.XXX.XXX/24
gateway 149.XXX.XXX.254
bridge-ports eno1
bridge-stp off
bridge-fd 0
hwaddress 0C:C4:7A:6C:5D:96

iface vmbr0 inet6 static
address 2001:41d0:1004:2d8::1/128
gateway 2001:41d0:1004:2ff:ff:ff:ff:ff

auto vmbr1
iface vmbr1 inet static
address 192.168.1.1/24
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 192.168.1.0/24 -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s 192.168.1.0/24 -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -p tcp -d 149.XXX.XXX.XXX --dport 80 -i vmbr0 -j DNAT --to 192.168.1.150:80
post-up iptables -t nat -A PREROUTING -p tcp -d 149.XXX.XXX.XXX --dport 443 -i vmbr0 -j DNAT --to 192.168.1.150:443
post-down iptables -t nat -D PREROUTING -p tcp -d 149.XXX.XXX.XXX --dport 80 -i vmbr0 -j DNAT --to 192.168.1.150:80
post-down iptables -t nat -D PREROUTING -p tcp -d 149.XXX.XXX.XXX --dport 443 -i vmbr0 -j DNAT --to 192.168.1.150:443

Example of VM configuration in attachment.
 

Attachments

  • Zrzut ekranu 2023-11-24 o 18.04.55.png
    Zrzut ekranu 2023-11-24 o 18.04.55.png
    156.4 KB · Views: 28

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!