8

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?

4
  • Hi, @Nick, did you succeed in setup? I have pretty similar issue with Android emulator running in Ubuntu VirtualBox.
    – Иван
    Jul 9, 2013 at 16:23
  • Please stop using net-tools (ifconfig, route, etc.). Use iproute2. It's messy and inferior in many other ways. See, this, this, this, and many others on the Stack Exchange.
    – pilona
    Oct 5, 2013 at 19:51
  • There are many levels at which traffic could get dropped: netfilter, ARP, bridging, routing, on two hosts. If not private, can you send the output of the following, on both the host and the guest? iptables-save; ip r; ip n; ip -4 a. On the host, please also run bridge fdb; bridge link. I'd be nice to also see the arguments used to run QEMU.
    – pilona
    Oct 5, 2013 at 19:54
  • To debug on your own though, try running tcpdump port 53 or icmp or your favourite packet sniffer, on all three of the machines. You'll want to run two instances on those performing bridging to see whether packets are both being received and retransmitted.
    – pilona
    Oct 5, 2013 at 19:55

1 Answer 1

4

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .