I'm running VirtualBox 5.0.20 on an OS X host. There's a variety of guest systems, including Ubuntu, CentOS, Windows and OS X.
For each of these systems, I created a live snapshot (i.e. while the VM is running) in which a server process (a Python script) is running on port 18812. I configured port forwarding for all the VMs via
$ VBoxManage modifyvm <vmid> --natpf1 rpyc,tcp,,18812,,18812
such that I can connect to
localhost:18812 on the host system to connect to the server process running in the guest.
This works all fine and dandy - until I power off the VM, restore the snapshot and then start it again. The server process appears to be still running and I can connect to it from within the guest, but connecting from the host system does not work anymore.
The port forwarding is still in effect, but the only way to make the server process reachable again seems to be to either restart the networking system in the guest (e.g. by running
service network-manager restart on Ubuntu) or by restarting the server process - neither of which is very desirable.
Is there a trick to setting up a VirtualBox VM such that when restoring a snapshot, the server process(es) running on it are reachable right away? For what it's worth, I noticed this issue on all guest systems and also with simple 'servers' like netcat listening on some port.