Port forwarding same port to multiple VMs using same port as well

cot

Active Member
Aug 24, 2015
33
1
26
Hi,

Is it possible for Promox host to use iptables sharing a single public IP and handle incoming traffic redirect to multiple VMs with the same port no. as well? I know it is possible if incoming traffic port numbers are different. However, if the incoming port is fixed, how can it be redirected to different internal VM using the same port no.?

Public IP:8484 -> VM1:8484, VM2:8484, VM3:8484, ....

Thanks in advance.
 
The combination IP + Portnumber is the adress of a single service!
See it like Housenumber + Flatnumber (or do you want to have people coming into your flat erradically?)

Of course it is possible to do some Loadbalancing for some services (probably in one VM), but all VM's behind the balancer have to service the same (read identical) service. It is not for servicing different things.
 
I have limited public IPs and would like to know if it is possible to share one public IP for the same or identical service port in each VM with different private IP addresses.
 
You can't do what you're talking about with NAT. Each EXTERNAL_IP:EXTERNAL_PORT combo has to map to a single INTERNAL_IP:INTERNAL_PORT combo.

You could do (not what you are talking about):

publicIP:80 -> 10.2.3.4:80
publicIP:81 -> 10.2.3.5:80
publicIP:82 -> 10.2.3.6:80

But to do something like (what I gather you are talking about):

publicIP:80 -> 10.2.3.4:80 or 10.2.3.5:80 or 10.2.3.6:80

you'd need something lime haproxy, or other load-balancing software, at which point you don't necessarily need the NAT anymore.