9

Trying to access the internet on a virtualbox VM with Ubuntu-20.04.1 LTS and a WiFi adapter.

The VM has 2 network adapters. NAT and host only with a host-only adapter with static IP address.

The netplan config looks like:

network:
  ethernets:
    enp0s3:
            dhcp4: yes
    enp0s8:
            addresses: [192.168.56.3/24]
            gateway4: 192.168.56.1
            nameservers:
                    addresses: [4.2.2.2, 8.8.8.8]
  version: 2

and ip addr show says:

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:dd:a6:04 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 86264sec preferred_lft 86264sec
    inet6 fe80::a00:27ff:fedd:a604/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:0e:27:7d brd ff:ff:ff:ff:ff:ff
    inet 192.168.56.3/24 brd 192.168.56.255 scope global enp0s8
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe0e:277d/64 scope link
       valid_lft forever preferred_lft forever

enp0s3 is assigned a 10.x.x.x address but still it doesn't work, whereas another VM which gets the same 10.x.x.x address does work.

What am I missing?

1 Answer 1

7

Probably, it is an issue with the default route. You don't need the Gateway and DNS for host-only network!

You may check it using: ip route show

Remove them from the configuration, so default Gateway goes to interface with NAT/DHCP configuration. Also DNS which does not seems to affect, but keep reasonable clean configuration.

3
  • Remove them from configuration?? This needs more details.
    – Ken Ingram
    Mar 24 at 20:13
  • @KenIngram Yeah the answer was specific to OP case, as he already knows where is and already modified it the configuration. It is hard cover every configuration layer: (1) OP uses netplan config in /etc/netplan/ see ref netplan.io/examples/#configuration (2) or some use switched network manger (3) VirtualBox has also a common configuration for host-only interfaces.
    – user.dz
    Mar 25 at 7:40
  • 1
    Ok. That makes sense. Thanks.
    – Ken Ingram
    Mar 30 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.