Hosting a Proxmox server from one public IP

mani613

New Member
Jun 14, 2017
1
0
1
28
So as the title suggests what I am trying to do is host my server from one public IP but ive run into issues trying to run Nginx on different virtual machines and of course the issue with that is on my network all of my ports are forwarded to the main server. So what ive tried and seen multiple times is setups like what im about to put down below but all that happens is a I cant ssh into any of my virtual machines expect the main server and Nginx does not even work.

Proxmox server IP:192.168.0.42 (hosting the Proxmox web UI)
Arch Server IP:192.168.0.45 (trying to host website)

........
auto vmbr2
iface vmbr2 inet static
address 192.168.0.45
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 '192.168.0.45/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.0.45/24' -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 22 -j DNAT --to 192.168.0.45:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 22 -j DNAT --to 192.168.0.45:22
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.0.45:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.0.45:80

There's probably a very obvious answer here
 
Hi,
You can't have 1 public IP and route the same port to a VM and also have that port open on the host.

One way you you could try to achieve your goal would be to have a service that conditionally forwards HTTP traffic based on the headers - this could be done with HAProxy or NGINX or I would imagine Apache but not sure on that.

You could have that HAProxy (or whatever) on the host or if you wanted it on a VM then you would NAT the port 80 traffic to that VM. You would then configure HAProxy to forward requests for example.com to 1.2.3.4 and something.com to 4.3.2.1 etc

re SSH, you wont find a solution other than having them on separate ports - so for your VM change the default port from 22 to 8022 etc. Then NAT 8022 to that VM

Good luck
 
I use proxmox on OVH, and use a VM with pfsense where I use public IP as a WAN iface. And Proxmox with a private one. You need to have a backdoor from OVH console or whatever in case pfsense fails (but rock solid freebsd down there).
 

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!