#3236 new enhancement
hostif networking doesn't work when link is down
回報者: | Bryce Allen | 負責人: | |
---|---|---|---|
元件: | network/hostif | 版本: | VirtualBox 2.1.2 |
關鍵字: | link down | 副本: | |
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.
更動歷史 (3)
comment:2 15 年 前 由 編輯
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.
-Technologov
comment:3 15 年 前 由 編輯
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.
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."