Vagrant: a better to way to “reset” the guest vagrant vm’s network

vagrantvirtualbox

I am relatively new to vagrant but certainly liking it so far.

One of the little problem I often face is that when my host machine's network goes down momentarily, it affects my connection to my vagrant guest vm.

When my host machine's network comes back up again, I have to – on my host machine – run vagrant halt and then vagrant up in order to "reset" my guest vagrant vm's network so that it can connect to the internet once again.

Is there a more "elegant" way of getting my vm's internet connection via my host machine's network to detect that the internet network connection is back up?

Best Answer

Yes, the easiest solution is to restart the networking subsystem within the VM itself. SSH connections shouldn't be interrupted. On Ubuntu, do the following:

sudo /etc/init.d/networking restart