VirtualBox – Guest VM looses DNS when host connects to VPN

Miss Santa
Miss Santa by Thien An

I’ve been using VirtualBox for a while to do experiments that require machines clustering. In some cases, my VMs need to connect to a private network through a VPN client (eg: Cisco AnyConnect). It works most of the time but occasionally it does not. I was in the situation where I was ready for a demo, but all of the sudden, things felt apart around 30 minutes before the show because my VMs could not connect to the private network after a host reboot (forced) with the helpfulness unknown host message .

So I’m running MacOS , VirtualBox 5 and here were the steps I took to bring my pieces back together

I’m putting here the “magic” command which saved my demo, just for a record for myself and in case the Force wants to challenge you with similar situation.

  1. Shutdown the VM(s) $ sudo shutdown now
  2. Run $VBoxManage modifyvm <my-vm-name> --natdnshostresolver1 on
  3. Start the VM(s)
  4. Take a deep breath and feel thankful, get ready for what’s next.

By the way, the demonstration went really well 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *