I don't know if this helps you, but almost the same thing works for me with Ubuntu 18.04.4 LTS (bionic) on Virtual Box 6.0.14.
$ ip addr
1: lo: [snipped, irrelevant]
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:a4:3b:77 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
valid_lft 75294sec preferred_lft 75294sec
inet6 fe80::a00:27ff:fea4:3b77/64 scope link
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:25:81:75 brd ff:ff:ff:ff:ff:ff
inet 192.168.56.8/24 brd 192.168.56.255 scope global enp0s8
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe25:8175/64 scope link
valid_lft forever preferred_lft forever
![copy of VBox Manager screen for my VM](https://cdn.statically.io/img/i.sstatic.net/l7wL1.png)
As you can see enp0s3 is NAT out to the world and enp0s8 is host-only. I don't remember what I did when I set this up; I think the installer did most of it, although I definitely specified manual (nonDHCP) address assignment on the host-only interface because I like to have those addresses match my VM names. My /etc/network/interfaces
says it is superseded by /etc/netplan
and that contains one file 50-cloud-init.yaml
(even though my system is not in any cloud whatsoever) with
$ cat 50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcp4: false
addresses: [192.168.56.8/24]
version: 2
If there's anything else I can check that would help you, ask.