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.


A workaround to the situation appears to be to toggle the link state of the VM right after starting it, i.e. on the command line do:

$ VBoxManage startvm <vmid>
$ VBoxManage controlvm <vmid> setlinkstate1 off
$ VBoxManage controlvm <vmid> setlinkstate1 on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.