Connect from host to VM in VirtualBox and allow Internet in VM

In order to do this, setup 2 network adapters for the VM, first one use NAT so the VM has access to the Internet through the host.

The second adapter is set to Host-only.

in the VM, run ipconfig and use the IP address of the VM under the host-only network to access from the host.

Use the default gateway to access host from inside the VM