Page 1 of 1

Keep alive Natnetwork in "savestate"

Posted: 1. Jul 2014, 10:12
by frenzi11
Hi,
I've already checked on documentation and forum but I didn't find any mention about my problem.
First of all some precondition about my system:
- host --> linux (debian)
- guest --> linux (debian)
- network configuration --> natnetwork with port forwarding

I'm doing some test about connection and I just learned that when a virtual machine is closed using "savestate" mode, every connection is broken.
To be precise I'm using netcat to connect to my guest machine from another pc in my internal network. Guest is in listen mode.
Everything work fine, but if I close the virtual machine in savestate the netcat connection is broken.

I'm looking for some tips which let me to keep alive nat network connection while my virtual machine is in "savestate".
Sorry for poor english, :oops: I hope to be enough clear.

Thanks in advance

Re: Keep alive Natnetwork in "savestate"

Posted: 1. Jul 2014, 12:28
by noteirak
Due to how TCP works, it is simply not possible. You could make it work in UDP tho.

Re: Keep alive Natnetwork in "savestate"

Posted: 1. Jul 2014, 19:44
by frenzi11
Sorry but I don't understand.... why do you think is just tcp?

I see that, during normal running state of guest, some virtualbox's processes which handle the natnetwork are active. Those processes start running even if I use:

Code: Select all

VBoxManage natnetwork start -t <networkname>
However when guest is closed in savestate those processes are closed ( supposing by virtualbox).

I thought that the "savestate" of virtualbox was like hibernation in a real machine but It's not. I've already tried the same test (a simple natcat connection) using two different real pc but even if I use hibernation to one of them, the connection stay alive.
So I'm rather sure that it is Virtualbox who send the FIN message for some reasons but...why?

Re: Keep alive Natnetwork in "savestate"

Posted: 1. Jul 2014, 20:18
by Perryg
Not possible. Saved state is the same as putting PC on metal to sleep. Nothing passes because there is nothing there until you wake it up.

Now screen savers that go to blank are a different thing.

Re: Keep alive Natnetwork in "savestate"

Posted: 1. Jul 2014, 21:14
by noteirak
Save state would be like freezing time itself if you would compare it to a physical PC. The guest OS is not even aware something is happening. When you restart it, it will have no knowledge something changed.
Hybernate, on the other hand, is handled by the OS itself (with help of the motherboard). The applications inside will have no knowledge something happened directly (but still can by listening to the OS or hardware events) and the OS will restore network connections and the like.

When you use the NAT Network feature of Virtualbox, the Virtualbox process handling the NAT network will not listen on that port until at least one VM using that network is running. So as soon as you've put your VM to Saved State, which is a state equivalent to "power off" for Virtualbox, the port will no longuer be listened on, and the TCP connection will be broken....

For the sake of being complete, be aware that when you use NAT only, the port forwarding is handled by the VM process itself, so it will disapear as soon as it ends.