DHCP not assigning Ubuntu VM an IP

I am trying to give my Ubuntu VM (16.04) on my Windows 10 host its own IP address via a Bridged Adapter on my local network so I can SSH in to it using a program like TightVNC (so I can view the GUI) from my Macbook Pro.

I am struggling to connect to my router at all from my VM (and thus cannot get an internet connection from my VM either. I could via NAT.). DHCP seems to be failing at assigning the VM an IP.

I have done the following -

On Windows 10 host using VirtualBox 5.2.0

  • Created VirtualBox Host-Only Ethernet Adapter in Global Tools and enabled DHCP server (unsure if necessary)
  • Configured network settings on VirtualBox to attach to (the correct) Bridged Adapter (wireless)

On Ubuntu 16.04 VM

  • Checked my network interface name using “ifconfig” to see that it is called enp0s3 (not eth0)
  • Added the lines “auto enp0s3” and “iface enp0s3 inet dhcp” to the file /etc/network/interfaces

Note: I do not have the file /etc/udev/rules.d/70-persistent-net.rules, however I do have the file /etc/udev/rules.d/60-vboxadd.rules which contains the following two lines (which I have not edited)

“KERNEL==”vboxguest”, NAME=”vboxguest”, OWNER=”vboxadd”, MODE=”0660” and
“KERNEL==”vboxuser”, NAME=” vboxuser”, OWNER=”vboxadd”, MODE=”0660”.

When I run ifdown enp0s3 followed by ifup enp0s3, ifup will eventually time out on DHCPDISCOVER… and output the lines No DHCPOFFERS received. and No working leases in persistent database – sleeping.

As of now I am unsure of what to do next.

1 Answer

I believe the problem you have occurs because of your VirtualBox setting that belongs to the Ethernet Adapter configuration: Host-Only Ethernet Adapter

As far as i know that setting would be helpfull if you would like to create multiple VM's that should be able to connect to each other, but not to the internet.

The VirtualBox Ethernet Adapter settings that you should use for letting your VM connect to the internet are: Bridged Adapter or NAT

One of the two, I think its Bridged Adapter will give you an IP that is reachable from your private home network.

Normally there is no need to modify any of the files in Linux that you mentioned in your question. That all should work automatically on startup.

EDIT: I have created you some Screenshots with steps from one to three.

Step one: Select your VM and right click on it. From the contextmenu select SettingsStep two: Navigate to Network. Click on the drop down menu next to Attached to: and select Bridged Adapter. Step three: Select in the drop down menu the hosts wifi or ethernet card that is connected to your router.

Run your VM and check with ifconfig if your virtual ethernet adapter gets an IP assigned.

EDIT II: You said you tried all the above and you still encounter this error. So here some more hints: First: Check in your VBox Network Settings of the specific machine if the checkbox Enable Network Adapter is checked. Second: Click on the Advanced button and check if the checkbox Cable Connected is checked too. Also have a look at the Adapter Tyoe drop down menu. I am using Intel PRO/1000 MT Desktop (82540EM). Promiscuous Mode is set to Deny and the MAC Adress is an unique one.

All those settings should be set automatically. So if you still encounter your problem i have to apologize for not beeing able to help you.

6

You Might Also Like