1

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

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. https://www.pic-upload.de/view-34609527/VBox_Ethernet.png.html

Step one: Select your VM and right click on it. From the contextmenu select Settings Step 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. https://www.pic-upload.de/view-34616510/VBox_Ethernet2.png.html

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.

| improve this answer | |
  • The very first thing I did before trying anything else is what you suggest to do. I started playing around with configuration files and settings because my routers DHCP was not assigning my VM an IP. – Mitchell Jan 7 '18 at 21:47
  • Btw: I do neither have a file called 70-persistent-net.rules My interface is called enp0s8 (not eth0) either. My /etc/network/interfaces is unmodified: auto lo iface lo inet loopback and nothing more. Networkmanager is left to automatic DHCP on IPv4 while DHCP is set to ignore on IPv6 – AlexOnLinux Jan 8 '18 at 9:46
  • I just wanted to ask you if you could add some more information: 1) Have you been able to go online with your VM using the NAT option? 2) Have you been able to get an IP assigned from VBox using the Host only Adapter option? 3) Is DHCP activated in your router? 4) What is the output of ifconfig -a and lspci -knn | grep Ethernet -A Regarding to your LOG No DHCPOFFERS received your ethernet adapters should be up and working while the router DHCP is not. DHCP might be turned off? If thats not the case, create a new Ubuntu VM and check if it works out of the box in bridge mode – AlexOnLinux Jan 8 '18 at 21:11
  • Sorry for late reply. I found the problem, my MAC address for the Bridged Adapter was incorrect. I now share the hosts network interface.. which isn't exactly what I wanted. I want to give the VM its own seperate Network Interface and implied IP address. But I think I can figure it out from here. Thanks for your help. – Mitchell Jan 10 '18 at 1:03
  • Glad to here you found the problem. I am a little confused about your statement, i thought you wanted an IP from your router, so you are able to ssh into the machine. If you want to create a new network go to VBox main preferences (CTRL + G), select Network and create a new network with the preferences you want. After creation, go to the network preferences of your VM and switch your Attached to setting to NAT Network and choose from the drop down menu below the networkname you just created. pic-upload.de/view-34627191/VBox_Ethernet3.jpg.html – AlexOnLinux Jan 10 '18 at 7:49

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.