VirtualBox

Opened 15 years ago

Closed 10 years ago

#4038 closed defect (obsolete)

Host Only / NAT: DHCP does not work always

Reported by: Martin Burger Owned by:
Component: network Version: VirtualBox 2.2.2
Keywords: Cc:
Guest type: other Host type: other

Description (last modified by vasily Levchenko)

Hello,

I am using VirtualBox 2.2.2 on Mac OS X 10.5.6. My guest OS is Debian Etch-and-a-half:

Linux etch08 2.6.24-etchnhalf.1-686 #1 SMP Fri Dec 26 04:10:16 UTC 2008 i686 GNU/Linux

I setup two network interfaces: Adapter 1 "NAT" and Adapter 2 "Host-only". Thus, the machine should have access to the internet (NAT) and I should have access to the virtual machine from my Mac without port forwarding (Host-only).

Most if the time, this setup works perfectly. However, sometimes one of the two interfaces does not get an IP v4 internet address, like this:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:4E:83:92 
          inet6 addr: fe80::a00:27ff:fe4e:8392/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:468 (468.0 b)
          Base address:0xc010 Memory:f0000000-f0020000

eth1      Link encap:Ethernet  HWaddr 08:00:27:98:09:41 
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe98:941/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:117 errors:0 dropped:0 overruns:0 frame:0
          TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21488 (20.9 KiB)  TX bytes:87887 (85.8 KiB)
          Base address:0xc240 Memory:f0820000-f0840000

In this case I can access the guest via 192.168.56.101, but the machine cannot access the internet. Sometimes it happens the other way around: eth0 gets 10.0.2.15 and eth1 does not get an address. Then, of course, the guest can access the internet but I cannot access it via network.

Attachments (6)

Debian Etch etch08-2009-05-18-12-53-47.log (39.4 KB ) - added by Martin Burger 15 years ago.
Requested log file
Debian Etch etch08-2009-05-18-12-53-47.2.log (39.4 KB ) - added by Martin Burger 15 years ago.
Requested log file
ifconfig.txt (1.3 KB ) - added by Martin Burger 15 years ago.
Output of ifconfig
eth0 - has ip address.png (32.5 KB ) - added by Martin Burger 15 years ago.
Screenshot: eth0 got ip adderss
eth0 - does not have ip address.png (30.2 KB ) - added by Martin Burger 15 years ago.
Screenshot: eth0 did not get ip adderss
ubuntu32bit.log (37.8 KB ) - added by Gabriel Garcia 14 years ago.
Ubuntu 32 bit - no DHCP server response for host only interface

Download all attachments as: .zip

Change History (50)

comment:1 by vasily Levchenko, 15 years ago

Hello, Could you please attach log files?

comment:2 by Martin Burger, 15 years ago

I would have done it. Unfortunately, during the last couple of startups this issue didn't occur. So, I could not access a proper log file. I will attach a log file as soon as I can reproduce this failure.

by Martin Burger, 15 years ago

Requested log file

by Martin Burger, 15 years ago

Requested log file

by Martin Burger, 15 years ago

Attachment: ifconfig.txt added

Output of ifconfig

comment:3 by Martin Burger, 15 years ago

I could reproduce the failure. I attached VirtualBox's log file and the output of ifconfig. As you can see, eth1 has no ip address and it was not offered by VirtualBox (in contrast to 10.0.2.15 for eth0).

Accidentally, I attached Debian Etch etch08-2009-05-18-12-53-47.log twice, sorry. Feel free to remove the second one.

comment:4 by Lars Rasmusson, 15 years ago

Sometimes symptoms as these occur because the OS sometimes names one network adapter eth0 and the other eth1, and sometimes the names are exchanged to eth1 and eth0 instead. This messes up the configuration process later. In some distros there are ways to configure which adapter should be called eth0 etc. by specifying the MAC address of the adapter. In Ubuntu this is done in the automatically managed file /etc/udev/rules.d/70-persistent-net.rules , others may have it in /etc/network/

Can you see which mac addresses eth0 and eth1 have when they work, and when they do not work, to rule out the case that they may have changed names?

ifconfig | grep HWaddr

comment:5 by Martin Burger, 15 years ago

My Debian system has a file /etc/udev/rules.d/z25_persistent-net.rules that configures eth0 and eth1:

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="08:00:27:4e:83:92", NAME="eth0"

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="08:00:27:98:09:41", NAME="eth1"

I assume the configuration above "pinpoints" the interfaces, doesn't?

by Martin Burger, 15 years ago

Attachment: eth0 - has ip address.png added

Screenshot: eth0 got ip adderss

by Martin Burger, 15 years ago

Screenshot: eth0 did not get ip adderss

comment:6 by Martin Burger, 15 years ago

I attached two screenshots. eth0 has the same MAC address in both cases. However, it did not get an ip address in both.

comment:7 by aevum, 15 years ago

I have the same problem with a Windows Vista host and Debian Lenny guest. Sometimes one of the interfaces doesn't get a DHCP address. I couldn't find anything interesting in the logs, but let me know if there is anything I can do to help fix this.

comment:8 by Carey Evans, 15 years ago

I've been having similar problems, with Windows XP and Windows Vista hosts and Debian Etch and Lenny guests. I've noticed that when I exit and restart VirtualBox on the host, the guest will probably not get an IP address when I start it, but if I only reboot the guest it probably will.

I'm currently trying auto eth0 instead of allow-hotplug eth0 in /etc/network/interfaces, which may be working better.

comment:9 by aevum, 15 years ago

I see this bug about once every three boots, no matter if it's a cold or warm start or if I use "auth" or "allow-hotplug".

Currently, I'm using "auto ethX" because I want to mount network file systems during boot. When the DHCP bug happens I get the following boot messages on my Lenny guest:

DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval nn DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval nn DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval nn ... No DHCPOFFERS received. No working leases in persistent database - sleeping.

Then the boot process hangs, because my network volumes can't be mounted.

I'm using eth0 as host-only adapter, eth1 as NAT. When the configuration works my ifconfig is:

eth0 Link encap:Ethernet HWaddr 08:00:27:18:92:7b

inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe18:927b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:90 errors:0 dropped:0 overruns:0 frame:0 TX packets:92 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20305 (19.8 KiB) TX bytes:12616 (12.3 KiB) Interrupt:19 Base address:0xd020

eth1 Link encap:Ethernet HWaddr 08:00:27:1e:fe:07

inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe1e:fe07/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6 errors:0 dropped:0 overruns:0 frame:0 TX packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1468 (1.4 KiB) TX bytes:1404 (1.3 KiB) Interrupt:16 Base address:0xd060

comment:10 by aevum, 15 years ago

This issue is still present in VirtualBox 3.0.4.

comment:11 by Chris, 15 years ago

I'd just like to add that I'm getting the same issue with an Ubuntu 9.04 (server) guest and a Windows XP host. Should we take this as evidence that this is somehow related to Debian's networking configuration?

in reply to:  11 ; comment:12 by aevum, 15 years ago

Replying to Davorian:

I'd just like to add that I'm getting the same issue with an Ubuntu 9.04 (server) guest and a Windows XP host. Should we take this as evidence that this is somehow related to Debian's networking configuration?

Do you also use two network interfaces with DHCP?

in reply to:  12 comment:13 by Chris, 15 years ago

Replying to aevum:

Replying to Davorian:

I'd just like to add that I'm getting the same issue with an Ubuntu 9.04 (server) guest and a Windows XP host. Should we take this as evidence that this is somehow related to Debian's networking configuration?

Do you also use two network interfaces with DHCP?

Yes, one host-only and one NAT. The host-only interface inconsistently gets a response from the VirtualBox DHCP. I haven't been able to pin down what solves the problem; sometimes it's a guest reset, sometimes a complete restart of VirtualBox, sometimes just bringing the interface down then up in the guest, other times /etc/init.d/networking restart.

comment:14 by mncaudill, 14 years ago

I was having this same problem and here is a work-around that seems to consistently work:

Info:
WinXP Host
Ubuntu 8.04 Guest
Host-only adapter as Adapter 1
NAT as Adapter 2


My symptoms were whatever was listed as Adapter 1 would get an IP address and Adapter 2. I rebooted and switched them 3 or 4 times and this was always the case. To fix this, I would just run 'dhclient' and it reconfigured my network interfaces and both interfaces would get an IP address.

comment:15 by Frank Mehnert, 14 years ago

Is this workaround still required for VBox 3.0.8?

in reply to:  15 comment:16 by mncaudill, 14 years ago

Replying to frank:

Is this workaround still required for VBox 3.0.8?

It is.

comment:17 by aevum, 14 years ago

I didn't have the problem since I upgraded to 3.0.8. I booted my Debian VMs about 20 times so far and DHCP always worked for both network adapters.

in reply to:  17 comment:18 by Martin Burger, 14 years ago

Replying to aevum:

I didn't have the problem since I upgraded to 3.0.8. I booted my Debian VMs about 20 times so far and DHCP always worked for both network adapters.

I booted my Debian system several times, no problems so far. Seems to be fixed.

comment:19 by Frank Mehnert, 14 years ago

mncaudill, two positive feedbacks. Are you sure that it still doesn't work for you?

in reply to:  19 comment:20 by mncaudill, 14 years ago

Replying to frank:

mncaudill, two positive feedbacks. Are you sure that it still doesn't work for you?

I have it working now. It seems that my /etc/network/interfaces file had gotten out of sync with the adapters that were activated, so I rebuilt that file and since then, I have had no difficulties.

I think this may be more user error on my part than a bug in the software.

comment:21 by Chris, 14 years ago

I don't see the problem anymore under 3.0.8 either. Was there a source change targeting this issue?

comment:22 by Frank Mehnert, 14 years ago

Resolution: fixed
Status: newclosed

There was a fix in the PCNet device which could cause that type of problems although I the initial reporter, mburger, used an E1000 device.

Anyway, as this bug seems to be fixed for everyone in 3.0.8 I will close this ticket. Thanks for your feedback!

comment:23 by Steve Steiner, 14 years ago

Resolution: fixed
Status: closedreopened

This problem occurs running Ubuntu 9.10 on an OS X 10.6 Virtualbox 3.1.0 r55467 setup.

Deleting /etc/udev/rules.d/70-persistent-net-rules.rules and restarting networking with sudo /etc/init.d/networking restart solved the problem.

Just leaving this for anyone that follows.

This problem is not solved, though it may have gone underground for a bit.

I had very similar problems with Parallels and earlier versions Ubuntu; deleting the rules file solved the problem there as well.

S

comment:24 by Steve Steiner, 14 years ago

Update: deleting the .rules file and restarting solves the problem once. Next system restart, the Host-Only adapter disappears again and it's not just sometimes, it's never there unless forced.

in reply to:  24 comment:25 by Lars Rasmusson, 14 years ago

Replying to ssteiner:

Update: deleting the .rules file and restarting solves the problem once. Next system restart, the Host-Only adapter disappears again and it's not just sometimes, it's never there unless forced.

Just a thought:

Can you check to see if you get a new MAC address each time, for some reason?

Why? If you do, ubuntu will assign the "new network card" a new interface (or "adapter") name (such as eth1), and it won't find the eth0 card. If that is the case, then removing the persistent-net-rules will temporarily solve the problem as the new network card would be called eth0, but the next time the card would be believed to be new and again called eth1, etc...

by Gabriel Garcia, 14 years ago

Attachment: ubuntu32bit.log added

Ubuntu 32 bit - no DHCP server response for host only interface

comment:26 by Gabriel Garcia, 14 years ago

I'm experiencing problems as well with Gentoo Linux 64bit host and Windows XP and Ubuntu Linux 32bit guests. Host-only interface never gets an IP address from the VBox DHCP server that I configured. NAT interface gets an IP address and works just fine. I tried static IP addresses which work just fine, and also tried to disable VBox's DHCP server and start one myself in the host - this also works just fine.

I attached my Ubuntu Linux log in case anyone can find anything I couldn't: http://www.virtualbox.org/attachment/ticket/4038/ubuntu32bit.log

in reply to:  26 comment:27 by Gabriel Garcia, 14 years ago

Replying to gabrielgi:

I'm experiencing problems as well with Gentoo Linux 64bit host and Windows XP and Ubuntu Linux 32bit guests. Host-only interface never gets an IP address from the VBox DHCP server that I configured. NAT interface gets an IP address and works just fine. I tried static IP addresses which work just fine, and also tried to disable VBox's DHCP server and start one myself in the host - this also works just fine.

I attached my Ubuntu Linux log in case anyone can find anything I couldn't: http://www.virtualbox.org/attachment/ticket/4038/ubuntu32bit.log

Also, I'm running VirtualBox 3.2.0

comment:28 by Rodney Beede, 13 years ago

Same issue still with 4.0.2.

Windows 7 64-bit Enterprise host.

Ubuntu Server 64-bit

Adapter 1 is NAT (eth0) Adapter 2 is Host (eth1)

comment:29 by Rodney Beede, 13 years ago

I can't even seem to get dhcp to work when I only have 1 adapter set as Host. Works fine though as NAT.

comment:30 by Rodney Beede, 13 years ago

The bug was found and a patch suggested at http://forums.virtualbox.org/viewtopic.php?f=6&t=37402

Quote:

in src/VBox/Main/ConsoleImpl2.cpp

line 4095 rc = VERR_INTNET_FLT_IF_NOT_FOUND;

should be a little earlier, before

line 4050 rc = host->FindHostNetworkInterfaceByName(HifName.raw(), hostInterface.asOutParam());

comment:31 by Rodney Beede, 13 years ago

Duplicate to Ticket #7905 now

comment:32 by Aleksey Ilyushin, 13 years ago

Can anybody confirm that the problem still appears with VirtualBox 4.0.4?

comment:33 by Rodney Beede, 13 years ago

I have just tested this with VirtualBox 4.0.4 upgrade.

It did reset my Host Network adapter to a new 192.168.xxx.yyy network while leaving the DHCP Server at the old network (192.168.sss.ttt) address. Once I updated the Host adapter to match 192.168.sss.ttt it worked fine.

Other than the upgrade not preserving the Host adapter correct IP address DHCP with Host works fine. You just have to correct this first in your VirtualBox preferences for it to work.

comment:34 by Marcello Nuccio, 12 years ago

For reference, this bug is related to Vagrant bug: https://github.com/mitchellh/vagrant/issues/455

comment:35 by Brian Candler, 12 years ago

I am getting what appears to be the same bug.

Host: OSX Lion, VBox 4.1.6

Guest: Ubuntu 10.04.3 x86_64. eth0 is NAT network, and eth1 is host-only network. (Intention is to run a VPN client on this VM, and use it as a gateway for other machines)

  • Sometimes it works fine for a while. Then after a few hours it stops. Default route goes, but this might be the VPN client.
  • Sometimes, I can ping 10.0.2.15 and have default route via 10.0.2.15, but can't ping the outside world (e.g. 8.8.8.8)
  • Sometimes I can't even ping 10.0.2.15, nor arping -I eth0 10.0.2.15, even though eth0 is configured as 10.0.2.2 correctly

In the latter state, if I try to release/renew DHCP (ifdown eth0; ifup eth0), then I get no response.

It has been failing a great deal this afternoon, even shutting down and restarting all VMs, which is why I'm updating this ticket.

However I do have an additional data point: I am running Adium, and this seems to get into a state where it consumes hundreds of UDP sockets. I just killed Adium, and my next attempt at getting VBox NAT networking worked. This might just be coincidence of course. But it could be relevant, as VBox 'NAT' networking may be allocating local sockets for each connection.

Adium bug report here: http://trac.adium.im/ticket/15672

Note: #6563 looks to be a similar problem, and may also be to do with socket exhaustion or socket leaks.

It would be great if VBox made use of true NAT via the host, and didn't have to allocate sockets (#9972, #1705)

comment:36 by Brian Candler, 12 years ago

Oops, it looks like I got some IP's crossed: 10.0.2.15 is the local IP, and 10.0.2.2 is what I should have been pinging. However it was definitely the case that 'ifdown eth0; ifup eth0' was unable to pick up an IP again.

comment:37 by Martin Burger, 12 years ago

I still have the same problem. Currently, I am using VirtualBox 4.1.12 on a host running Debian Squeeze. The guest runs Debian Squeeze as well.

In contrast to my setup as used and described 3 years ago, I run my own DHCP server now. That DHCP server runs on the same host machine. NIC 1 is attached as "Host-only Interface 'vboxnet0'", NIC 2 as "NAT".

I have to restart the guest several times until both interfaces would get an IP address. Please note that running dhclient -r on the guest machine does not help. The DHCP server does not receive any request. Only when an IP address can be successfully obtained during the boot process, the DHCP server receives corresponding requests.

in reply to:  37 comment:38 by vasily Levchenko, 12 years ago

Description: modified (diff)

Replying to mburger: Could you please attach log from 4.0.12. What is exactly happens, which interfaces of your guest doesn't receive IP address or both? does your own DHCP server suppose to handle vboxnet0 interface?

comment:39 by apwashere, 12 years ago

Seeing the same issue with VirtualBox 4.1.12r77218, host OS Windows 7 SP 1 x64, guest OS Ubuntu 10.04.3 LTS: the logs of the affected VMs stop at

...
00:00:18.558 Guest Log: vboxguest: major 0, IRQ 9, I/O port d020, MMIO at 00000000f0400000 (size 0x400000)
00:00:20.164 Display::handleDisplayResize(): uScreenId = 0, pvVRAM=0000000005f20000 w=640 h=480 bpp=0 cbLine=0x140, flags=0x1
00:00:21.642 NAT: IPv6 not supported

(I'm running vagrant [1] on top of VirtualBox, so these are headless sessions)

The following workaround works for me: trigger dhclient on the guest using VBoxManage. ifdown/ifup also works, but that kills the vagrant connection, which I'm trying to avoid.

C:\Program Files\Oracle\VirtualBox>VBoxManage guestcontrol "my-machine-name" exec "/usr/bin/sudo" --username vagrant --password vagrant --verbose --wait-stdout dhclient

Of course, you can run dhclient directly if you can log in with a suitably authorized user ;-)

Here's ifconfig before:

eth0      Link encap:Ethernet  HWaddr 08:00:27:41:53:f3
          inet6 addr: fe80::a00:27ff:fe41:53f3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:139 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8340 (8.3 KB)  TX bytes:468 (468.0 B)

and after running the command:

eth0      Link encap:Ethernet  HWaddr 08:00:27:41:53:f3
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe41:53f3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:176 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:11620 (11.6 KB)  TX bytes:1152 (1.1 KB)

Hope this helps!

ap

[1] http://vagrantup.com

in reply to:  39 comment:40 by vasily Levchenko, 12 years ago

Replying to apwashere: Have you notice some period in this issue? Has dmesg contains some dhcp related messages? and what is located in /var/lib/dhcp*/dhclient.eth0.leases just before dhcp client restart? Is it happens for you if host-only doesn't present in your configuration?

Last edited 12 years ago by vasily Levchenko (previous) (diff)

comment:41 by apwashere, 12 years ago

Hachiman: thanks for your questions. Unfortunately I haven't been able to do much investigation because vagrant locks the sessions of machines it's creating, so they are not accessible via the console (I would have to use guestcontrol).

I can say that I haven't observed any particular periodicity. The first VM creation after a reboot generally works and then the second or third will fail. From that point on most of the following VMs seem to fail, but one or two in between will work.

The error occurs without a host-only adapter present - vagrant only creates these once it can access the machine (via the NAT adapter).

in reply to:  41 comment:42 by vasily Levchenko, 12 years ago

Replying to apwashere:

Hachiman: thanks for your questions. Unfortunately I haven't been able to do much investigation because vagrant locks the sessions of machines it's creating, so they are not accessible via the console (I would have to use guestcontrol).

Could you please then enable tracing in vm configuration https://www.virtualbox.org/wiki/Network_tips and attach pcap file for one of vms failed to achieve IP address?

comment:43 by apwashere, 12 years ago

@Hachiman: I will when I next run into failures. Sorry, but since I've managed to get things working I don't have much time to spend on it at present :-(

comment:44 by Frank Mehnert, 10 years ago

Resolution: obsolete
Status: reopenedclosed
Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use