4
3
I grabbed a small FreeBSD live CD and QEMU, and I'm trying to bridge my Mac OS X 10.8 wifi connection so that the guest OS is available on my LAN. However, the guest OS never gets a DHCP lease.
This works perfectly with VirtualBox in their "bridged" network mode, so I know it can be done. I need to get it working with QEMU because VirtualBox doesn't support the architecture that I need for this project.
Here's what I've done so far based on hours of googling:
Installed TUNTAP for OS X
Told OS X to supposedly forward all packets, even ARP: (NOTE: This doesn't appear to work.)
$ sudo sysctl -w net.inet.ip.forwarding=1 $ sudo sysctl -w net.link.ether.inet.proxyall=1 $ sudo sysctl -w net.inet.ip.fw.enable=1
Created a bridge:
$ sudo ifconfig bridge0 create $ sudo ifconfig bridge0 addm en0 addm tap0 $ sudo ifconfig bridge0 up $ ifconfig bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ether ac:de:xx:xx:xx:xx Configuration: priority 0 hellotime 0 fwddelay 0 maxage 0 ipfilter disabled flags 0x2 member: en0 flags=3<LEARNING,DISCOVER> port 4 priority 0 path cost 0 member: tap0 flags=3<LEARNING,DISCOVER> port 8 priority 0 path cost 0 tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 ether ca:3d:xx:xx:xx:xx open (pid 88244)
Started
tcpdump
with-I
in the hopes that it enables promiscuous mode on the wifi device:$ sudo tcpdump -In -i en0
Run QEMU using the bridged network instructions:
$ qemu-system-x86_64 -cdrom mfsbsd-9.2-RELEASE-amd64.iso -m 1024 \ -boot d -net nic -net tap,ifname=tap0,script=no,downscript=no
But the guest system never gets a DHCP lease:
If I tcpdump -ni tap0
, I see lots of traffic from the wireless network. But if I tcpdump -ni en0
, I don't see any DHCP traffic from the QEMU guest OS.
Any ideas?
Update 1: I tried sudo defaults write "/Library/Preferences/SystemConfiguration/com.apple.Boot" "Kernel Flags" "net.inet.ip.scopedroute=0"
and rebooting per this mailing list suggestion, but this didn't help. In fact, it made VirtualBox bridged mode stop working.
Update 2: Interestingly, the virtual interface on the QEMU guest only gets broadcast packets. Maybe I need to add a route somehow? Hmm...
@apaidnerd did you finally find a working solution ? – Chris V. – 2017-01-27T05:39:42.420
@ChrisV. Nope, never found a solution. Maybe things are better with newer versions of Mac OS? – a paid nerd – 2017-01-28T20:44:00.860
@apaidnerd well yes, I've found that Wifi does not support it because it's locked and doesn't support promiscuous mode. Or maybe someone has found a hack but in my case, things worked just fine when tried with a LAN interface. Too much time spent for nothing but the reward was a running qemu machine. – Chris V. – 2017-01-30T08:04:32.920
@ChrisV. Oh cool. If you could document the exact steps you did, along with what OS version you're running, and make it an answer instead of a comment, I'll mark it as the accepted answer :) – a paid nerd – 2017-01-30T22:12:11.520
tcpdump -ni tap0
is showing DHCP from guest? Did you try to mess with packet filter? – week – 2013-11-08T22:32:26.610If you start the VM in NAT, can you access your LAN and the Internet? – MariusMatutiae – 2013-11-14T16:18:06.447
@week pf is definitely disabled on the Mac host. – a paid nerd – 2013-11-14T19:50:38.760
@MariusMatutiae Yes, NAT works fine. – a paid nerd – 2013-11-14T19:50:58.543
Can you tell us why you are using en0 for the bridge? I thought you were trying to share your wifi connection with FreebSD. Also, you never said anything about configuring the if in FreeBSD. Did you bring the interface up? Did ask your router for an IP number? Lastly did you set up the routing table? – MariusMatutiae – 2013-11-14T20:56:01.527
@MariusMatutiae Yep, I'm trying to share my OS X wifi connection with FreeBSD, but have the FreeBSD guest be available to all servers on the LAN. In the guest I've run
ifconfig
to set the IP address manually and I've also triedkillall dhclient ; dhclient em0
, but as shown, the guest only gets UDP broadcast traffic, not ARP/DHCP. I played with the routing table and got nowhere. – a paid nerd – 2013-11-14T21:05:19.060Thanks, but you did not answer one question: why did you add to your bridge en0 instead of your wireless interface? – MariusMatutiae – 2013-11-14T21:07:35.803
@MariusMatutiae
en0
is my wireless interface on my MacBook Pro with Mac OS 10.8. – a paid nerd – 2013-11-14T22:28:37.667Can you pls post the two routing tables? – MariusMatutiae – 2013-11-14T23:42:28.340
@MariusMatutiae Mac OS X host here and FreeBSD guest after fresh reboot here
– a paid nerd – 2013-11-14T23:50:31.920let us continue this discussion in chat
– a paid nerd – 2013-11-14T23:50:38.863This article might be useful : Bridging a Wireless Card in KVM/QEMU.
– harrymc – 2013-11-17T21:02:17.303@apaidnerd I have found some relevant info, are you still interested? – MariusMatutiae – 2013-11-21T17:07:43.583
@MariusMatutiae Absolutely! – a paid nerd – 2013-11-21T22:34:09.400