12

(ANSWER BELOW)

I have problem with implementing Host-Only network in Virtualbox. my host machine is running under Windows 7 Ultimate, and guest OS is Ubuntu Server 12.04.2 64bit.

I configure virtual box host-only adapter.

Virtual box host-only adapter configuration

VirtualBox Host-only adapter - DHCP Server disabled

As you can see DHCP Server is disabled and i try both enabled and disabled but problem still there.

Below is result of

ipconfig /all

from Windows CMD

Windows ipconfig /all Results

Now My Virtual Machine Network Settings

Virtual Machine Network Settings

When i run VM the ubuntu force some problem with network configuration as image below

Ubutnu Booting Network configuration problem

My /etc/network/interfaces file as below:

/etc/network/interfaces content

When i restart networking service, show "Cannot find device eth1, Failed to bring up eth1 as below:

restart networking error

if i go with "ifdown" options, response as bleow:

enter image description here

any help will be appreciated

Thanks in advance


ANSWER

VirtualBox network adapter name on guest machine is not fixed all the time, each time you have disable and enable host adapter from VB prefrences, the network device name post-appended number will increase . For example, if you disable and enable network host-only adapter five times, the new network name should be eth4, and if it was eight times , network name will should be eth7 and so on.

if you don't know what is your current network device name, use:

ifconfig -a 

it will print all available network adapters ( devices ), find your new name and reconfigure /etc/network/interfaces file with new name.

for DHCP configuration use code below with changing eth5 with your current device name

auto eth5
iface eth5 inet dhcp

And for static ip you can code below: ( you still need to change eth5 with your device name, and also the static ip, no need to change netmask in most situations):

auto eth5
iface eth5 inet static
        address 192.168.56.101
        netmask 255.255.255.0

I hope this will help somebody else.

Mormegil
  • 113
Mohammad Ahmad
  • 223
  • 1
  • 2
  • 5
  • You should not post your answer in the question but post it as an answer yourself (you are allowed to answer your own questions) and mark it as solved. – lindhe Jun 28 '14 at 21:47

3 Answers3

2

To see a list of the adapters your virtual machine can access, use this:

ls /sys/class/net

This will show you the interface names. For example, with two network adapters set up, my Ubuntu guest looks like this.

eth1  eth2  lo
  • Thanks for the tip! Do you have any idea why I have only: eth0 and lo ? I'm running Zentyal 3.2.4 which is Ubuntu actually but added some feature to configure it from a web interface. – el.severo Nov 25 '13 at 00:42
  • Try adding another network adapter. It should show up in /sys/class/net. The second adapter will likely be listed as eth1, but maybe as eth2, or eth3, etc. – Christian Long Nov 25 '13 at 21:37
  • The interesting thing is that it appears only eth0 and lo. – el.severo Nov 25 '13 at 21:48
1

It does not need to be eth1. On my virtual machine, it's eth2.

What does ls /dev/eth* print, in your case?

ignis
  • 4,197
  • Thanks, you give me a big hint, you are right, it's not eht1, on my VM it's eth5, if you print "ifconfig -a" will print names for all current active netwrok devices. BTY "/dev/eth*" not working with me. i can't believe how much time spent on this small issue – Mohammad Ahmad May 06 '13 at 14:21
  • But there is one small issue, why it's not working even if DHCP enabled, it's should working automatically. i will update my question with right answer. – Mohammad Ahmad May 06 '13 at 14:25
0

Faced the same issue after upgrading from Virtualbox 4.x to 5.x (on Debian, but that surely apply to Ubuntu as well). I've left a gateway 0.0.0.0 in the /etc/network/interfaces declaration of eth1 (vboxnet0, host-only), which was fine for the 4.x, but crashed the service in 5.x with failed to bring up eth1.

Removing the gateway (and broadcast and network) of eth1 declaration did the trick.

Note that you may have fixed rules in /etc/udev/rules.d/70-persistent-net.rules that you may want to delete/update.

Yvan
  • 151
  • 2