I am using ubuntu 18 minimal image to create a ubuntu server with virtual box. I created a host only network and added adapter to vm along with NAT adapter (already configured).
original configuration of netplan was following.
network: version: 2 renderer: networkd ethernets: enp0s3: dhcp4: yes
I changed this configuration to 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 vm from host machine over network. but internet inside 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 vm is trying to connect to internet via host only adapter. How can I change this?