Ubuntu – Ubuntu 18.04 VirtualBox Guest – No Internet Access

dnsnetworkingvirtualbox-networking

I have Ubuntu 18.04 installed in a VirtualBox guest. The VM is configured with two adapters to provide internet access and connectivity to other VMs, which are:

Adapter 1: NAT (enp0s3)

Adapter 2: Internal Network (enp0s8)

When only the NAT adapter is enabled, internet access works fine.

When both adapters are enabled, I am still able to ping to the outside world by IP address, such as 8.8.8.8, but not by hostname, or web page, indicating a DNS issue.

enp0s3 is set to automatically receive an IP by DHCP and gets the usual 10.0.2.15 IP and is working fine when it is the only adapter enabled.

enp0s8 is set with a static IP (192.168.1.1), with the DNS and gateway options left blank. I am struggling to find the issue of why enabling the internal network adapter is causing this problem?

Best Answer

  • /etc/network/interfaces has been replaced by netplan on Ubuntu 18.04 (Why did Ubuntu change the network configuration)

    The following works for me:

    sudo vim /etc/netplan/60-mynetwork.yaml

    network:
        ethernets:
            enp0s8:
                dhcp4: true
        version: 2
    

    sudo netplan apply