I am using Ubuntu 18 minimal image to create an Ubuntu server with VirtualBox. I created a host only network and added adapter to vm along with NAT adapter (already configured).
The original configuration of netplan was the following:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: yes
I changed this configuration to the following to enable host only adapter (enp0s8):
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: ye
enp0s8:
dhcp4: no
addresses: [192.168.56.101/24]
gateway4: 192.168.56.1
Now I am successfully able to access the VM from the host machine over the network. But internet inside the VM stops working :(. I have tried so many different solutions but either I get internet working (provided by NAT adapter) by disabling host only adapter, or can access vm from host by enabling host only adapter.
I suspect the VM is trying to connect to internet via host only adapter. How can I change this?