Page 1 of 1

Same Port Forwarding on two VMs.

Posted: 13. Apr 2021, 15:35
by hack3rcon
Hello,
I have two VMs and I configured Port Forwarding on both of them as below:

Code: Select all

Host IP        Host Port        Guest IP        Guest Port
127.0.0.1      2080             10.0.3.15       80
Both of my VMs running Apache Web Server. If I browse "http://127.0.0.1:2080" on my host OS, then it forwarded to which VM?

Thank you.

Re: Same Port Forwarding on two VMs.

Posted: 14. Apr 2021, 00:03
by scottgus1
Probably either the first VM that started, or a crap shoot between the two depending on which VM's network code is in the processor when the request comes in. I don't think there is a way for us to tell without experimentation.

Re: Same Port Forwarding on two VMs.

Posted: 19. Apr 2021, 11:57
by hack3rcon
scottgus1 wrote:Probably either the first VM that started, or a crap shoot between the two depending on which VM's network code is in the processor when the request comes in. I don't think there is a way for us to tell without experimentation.
Is it not a problem?

Re: Same Port Forwarding on two VMs.

Posted: 19. Apr 2021, 13:02
by fth0
scottgus1 wrote:Probably either the first VM that started
This. Starting a VM means creating and running a VirtualBoxVM process in the host OS, which will then try to bind to the networking port exclusively. The networking stack of the host OS will typically accept the first process and reject others. Otherwise, another process (or application) could steal the port from the first process. In consequence, the first VM started will win.

Re: Same Port Forwarding on two VMs.

Posted: 26. Apr 2021, 10:34
by hack3rcon
Thank you.