QEMU within VirtualBox and bridged connections all the way down

I'm trying to get an ARM QEMU system out on my LAN. I tried running QEMU directly from Windows (Windows 7 x64), with success except I could not get a TAP adapter to bridge to my wireless connection. Specifically, Windows refused to bridge any of my network adapters.

So, I tried using QEMU within a Ubuntu virtual machine (which, surprisingly, turns out to be quite a bit faster, which is why I'd like to stick with it). The Ubuntu VM is bridged to my wireless connection, and works fine. I've setup a bridge within Ubuntu using a TAP device, and I believe it is setup correctly, but save for getting a DHCP address from my LAN, it won't work.

  • Windows 7 x64 Host
    • Ubuntu 12.04 32-bit VM
      • QEMU ARM running Debian Squeeze

I believe there is a routing problem, but I cannot pinpoint it.

  • My LAN is setup for DHCP at 1.1.1.0/24, and the gateway is 1.1.1.1 (yes, this is dumb but it is not the issue)
  • Ubuntu has the following configuration:

[Need a not-so blank line here for pre tag to work below...]

br0 Link encap:Ethernet  HWaddr 08:00:27:74:6b:ec  
inet addr:1.1.1.16  Bcast:1.1.1.255  Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe74:6bec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:3135 errors:0 dropped:0 overruns:0 frame:0
TX packets:967 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0 
RX bytes:681918 (681.9 KB)  TX bytes:79747 (79.7 KB)

eth1 Link encap:Ethernet  HWaddr 08:00:27:74:6b:ec  
inet6 addr: fe80::a00:27ff:fe74:6bec/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
RX packets:14249 errors:0 dropped:0 overruns:0 frame:0
TX packets:5850 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 
RX bytes:15166414 (15.1 MB)  TX bytes:431255 (431.2 KB)

tap1 Link encap:Ethernet  HWaddr 96:f3:2d:ae:c8:08  
inet6 addr: fe80::94f3:2dff:feae:c808/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:161 errors:0 dropped:0 overruns:0 frame:0
TX packets:2262 errors:0 dropped:3 overruns:0 carrier:0
collisions:0 txqueuelen:500 
RX bytes:12144 (12.1 KB)  TX bytes:262799 (262.7 KB)

QEMU is as follows:

enter image description here

And my server confirms it:

tail /var/log/dnsmasq.leases
1341855255 52:54:00:12:34:56 1.1.1.144 * *

So QEMU is getting an IP address, but otherwise seems not connected:

root@arm-emu:~# ping google.com
ping: unknown host google.com

root@arm-emu:~# ping 1.1.1.1
From 1.1.1.144 Destination Host Unreachable

This is what I used to setup the bridge--in Ubuntu:

tunctl -t tap1 -u root
brctl addbr br0
ifconfig eth1 0.0.0.0 promisc
brctl addif br0 eth1
dhclient br0
brctl addif br0 tap1
ifconfig tap1 up

In QEMU, I am just using DHCP for eth0, no special configuration.

Am I doing this wrong, what with my bridged bridge connection?


I know I'm late, but I encountered the same problem recently.

Mainly find the solution here:

http://ajitabhpandey.info/2007/07/interconnecting-qemu-and-virtualbox-virtual-machines/

Key steps are enable IP forwarding and setup MASQUERADING on the bridge interface:

$ echo "1" > /proc/sys/net/ipv4/ip_forward
$ sudo iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE

Now QEMU can access the internet, and can be reached by VirtualBox and the host.

But can not access other computers on the same LAN.

As English is my second language, anyone willing to improve this answer would be appreciated.