Hi,
I have a single public IP and would like to use it for my VMs, the usual way would be to add firewall rules like so:
This has two disadvantages:
1- you have to add a new rule for every port you want to share, in my case the VM I'm trying to reach is a development machine which I open ports in it occasionally, I also have a cloudbox VM that requires quite a handful of ports to be open.
2- if you want to run a service on a specific port (e.g https on 443) on both the proxmox machine and the VM you can't (without exposing a different port number, which might be difficult to change on the client side in some cases).
so my idea is to match requests based on hostnames so for example
let's say:
main proxmox public IP: 1.1.1.1
VM1 private IP: 10.10.10.2
VM2 private IP: 10.10.10.3
and in the dns registrar i have:
proxmox.com. A 1.1.1.1
vm1.proxmox.com. A 1.1.1.1
vm1.proxmox.com. A 1.1.1.1
so all hostnames are pointing to the same public IP.
now when the request reaches proxmox it should look at the requested hostname and based on that it should decide if the request should go to vm1 or vm2(regardless of the port number)
Is this possible to achieve?
Regards
I have a single public IP and would like to use it for my VMs, the usual way would be to add firewall rules like so:
Code:
iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2223 -j DNAT --to 10.10.10.3:22
1- you have to add a new rule for every port you want to share, in my case the VM I'm trying to reach is a development machine which I open ports in it occasionally, I also have a cloudbox VM that requires quite a handful of ports to be open.
2- if you want to run a service on a specific port (e.g https on 443) on both the proxmox machine and the VM you can't (without exposing a different port number, which might be difficult to change on the client side in some cases).
so my idea is to match requests based on hostnames so for example
let's say:
main proxmox public IP: 1.1.1.1
VM1 private IP: 10.10.10.2
VM2 private IP: 10.10.10.3
and in the dns registrar i have:
proxmox.com. A 1.1.1.1
vm1.proxmox.com. A 1.1.1.1
vm1.proxmox.com. A 1.1.1.1
so all hostnames are pointing to the same public IP.
now when the request reaches proxmox it should look at the requested hostname and based on that it should decide if the request should go to vm1 or vm2(regardless of the port number)
Is this possible to achieve?
Regards