I'm trying to setup a bridge between my Wi-Fi connection and an emulator (QEMU). I need a virtual machine to be on the same LAN as the host, with its own IP address.

QEMU requires using a TAP (virtual network device) so I have installed tuntaposx, have it running, and can open up QEMU using a TAP:

qemu-system-arm -kernel zImage.integrator -initrd arm_root.img -m 256 -net nic -net tap,ifname=tap1 -nographic -append "console=ttyAMA0" 

I have a script that configures the bridge once QEMU has opened up the TAP interface:

sysctl -w net.link.ether.inet.proxyall=1
sysctl -w net.inet.ip.forwarding=1
sysctl -w net.inet.ip.fw.enable=1
ifconfig bridge0 create
ifconfig bridge0 addm en1
ifconfig tap1 up
ifconfig bridge0 addm tap1
ifconfig bridge0 up

If I manually set an IP on the VM, I can ping from the VM to the host, but not from the host to the VM. Also, I can't access the rest of the network from the VM - including not being able to set an IP over DHCP.

Any ideas?

  • Good luck, sir! This is as far as I've gotten, too. – a paid nerd Nov 6 '13 at 2:38
  • I have provided a solution to this problem here. – NucAr Apr 26 '14 at 15:40
  • 1
    NucAr, openvpn or the likes is overkill. Just use natd. – guylhem Jun 8 '14 at 20:07
  • WiFi cannot be bridged. – Daniel B Sep 9 at 16:37

You are forgetting 2 important steps : running the natd daemon and configuring the firewall to allow that traffic, ie :

natd -interface en0 ipfw add divert natd ip from any to any via en0

en0 is my wifi interface (macbook air) and this work like a charm. The proposed openvpn solution is overtly complicated.

You can also run natd in fancier ways (ex: # fancy: natd -alias_address -interface en0 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss) if you want to be very specific, but the above will work.

I detailed the whole process on http://en.blog.guylhem.net/post/88201449689/running-qemu-with-tap0-and-nat-under-osx-10-9-maverick


-netdev tap,id=xxx,ifname=tap0 -device e1000,netdev=xxx. You need device-specific and make sure your kernel supports it, intel e1000 should be universally supported. I fixed the bridge problem on my mac running a x86 VM, since I don't need to connect to the internet, in my case, I just need to connect multiple VM in the host network. So I didn' addm en0. P.S. remember to have a addm script, the qemu -netdev tap will alert this error to you. Hope this will fix your problem.

  • Please clarify what you are answering. – Pimp Juice IT Sep 10 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.