Ticket #3236 (new enhancement)

Opened 9 years ago

Last modified 8 years ago

hostif networking doesn't work when link is down

Reported by: bda Owned by:
Priority: minor Component: network/hostif
Version: VirtualBox 2.1.2 Keywords: link down
Cc: Guest type: other
Host type: Linux


I route traffic from eth0 to wlan0, and use hostif eth0 for VirtualBox. If no devices are physically connected to eth0 (and turned on), the kernel reports 'eth0: link down', and virtualbox networking doesn't work. When a devices is on and connected to eth0, the kernel reports 'eth0: link up', and virtualbox networking starts working. If I disconnect the device from eth0 it stops working again.

I could just use wlan0 hostif instead, but then it's difficult to filter the traffic, run my own DHCP server, etc. Also I already forward eth0 to wlan0 for physical devices, and it makes sense to use the same setup for virtualbox.

Change History

comment:1 Changed 9 years ago by bda

Just to clarify, I am not talking about the "administrative" state of the interface (what's reported by ifconfig/ip), but the "operational" state (e.g. is it plugged in to a switch or other network device).

The best workaround I found for this is to setup a tap interface in the same way I setup eth0, and use that for the hostif. This pretty much solves the issue, but it would still be nice if I could use eth0.

From Documentation/networking/operstates.txt: "It is guaranteed that only the driver has write access" [to the IFF_LOWER_UP flag]. Is there some way for the filter driver to ask the host driver to change the operational state?

If this is not possible or reasonable, I suggest adding a note to the documentation, something like this:

"Note: if you are using a physical device for the host interface then it must be plugged in to function properly with VirtualBox. Consider using a tap device instead if this causes problems."

comment:2 Changed 8 years ago by Technologov

I am not sure why bridging is supposed to work, when a device is down ? I think it should not work.

Please explain a bit more about your problem.


comment:3 Changed 8 years ago by bda

The device is up (as reported by ifconfig), but the cable is unplugged. The idea is to route and share internet, available through wireless, with both virtualbox guests and real clients plugged into an internal ethernet network, and use the same firewall rules for both.

To make things more concrete, lets say computer A is connected to the internet via wlan0, and also has an ethernet device eth0. Virtualbox can use eth0 as the host interface, and a laptop without wireless could be physically connected to eth0, and computer A can be used as a router to share internet over the wireless connection with both the laptop and virtualbox guests. This actually works as long as an active device is plugged into eth0. The problem is that as soon as the laptop is unplugged from eth0, the virtualbox guests will loose their internet connection because eth0 is now in the "link down" (no cable) state (but still 'up' as far as ifconfig is concerned) and won't accept traffic.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use