1

For some background, I have one VM that must stay host-only with no internet access. My second VM needs both a bridged network adapter (or whichever would be best) for internet access and a host-only adapter to be able to communicate with the first VM.

On my second VM (Ubuntu Server), whichever adapter I specify as adapter 1 works great, but I can't get the second to work. I've tried with the host-only adapter being #1 and vice-versa.

I've tried editing /etc/network/interfaces and adding my enp0s8 interface, but to no avail. Specifically, I added

auto enp0s8
iface enp0s8 inet dhcp

ip addr shows that my enp0s8 interface (the host-only one) is not being given an IP. Is there a way to make sure it is given an IP on boot?

1 Answer 1

0

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

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.

2
  • Ah thanks, I'll have to come back to it in a bit. Right now I'm actually having trouble getting my host-only network to even work. Can't ping guests from the host, and can't access the webservice that's running on the guest from host. Commented Apr 23, 2021 at 17:10
  • A plausible solution is here: superuser.com/a/1740082/1083186
    – Asrar
    Commented Sep 1, 2022 at 0:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .