Bridged network on macOS host (10.14.6 Mojave)

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
KCmacos
Space Cadet
Posts: 4
Joined: Sun Oct 27, 2019 2:51 pm

Bridged network on macOS host (10.14.6 Mojave)

Post by KCmacos »

Has anyone managed to get bridged networking to work under Mojave? I'm using tuntap_20150118 from http://tuntaposx.sourceforge.net and qemu 4.1.0 from brew. I create my bridge with:

ifconfig bridge1 create
ifconfig bridge1 addm en0
ifconfig bridge1 up

en0 is my ethernet adapter on my Mac connected to my local network.

I start qemu with:

qemu-system-x86_64 -accel hvf -cpu host -m 512 -hda alpine.qcow2 -netdev tap,id=network0,script=no,downscript=no -device e1000,netdev=network0

(In this specific case I'm starting an Alpine Linux VM but I figured my question about the bridge should be common for PowerPC or any other VM.)

I attach the tap adapter and bring the bridge up:

ifconfig bridge1 addm tap0
ifconfig bridge1 up

If I tcpdump on the tap interface I can see DHCP requests from the VM but no replies. If I tcpdump on the bridge interface I can see the DHCP requests and replies from the DHCP server (running on the same network on a FW). I don't see any checksum errors or anything else weird, but traffic on the tap interface only flows one way, from the VM.

What am I doing wrong here? I can see in the forum that many others have gotten bridged network to function, but with older versions of macOS. Do I need to do anything differently under Mojave?
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Bridged network on macOS host (10.14.6 Mojave)

Post by Cat_7 »

Hi,

Tuntaposx works in Mojave on my side.
Before running Qemu, I create bridge1 in network preferences and add en0 to it.

Then start Qemu as root with:
#!/bin/bash
cd "$(dirname "$0")"
./qemu-system-ppc -L pc-bios -boot c -M mac99,via=pmu -m 512 \
-device sungem,netdev=network0 -netdev tap,id=network0,script=./tap-scripts/tap-up.txt,downscript=./tap-scripts/tap-down.txt \
-drive file=/Users/hsp/Mac-disks/9.22.img,format=raw,media=disk

The content of the tap-up script is:
#!/bin/sh
#
TAPDEV="$1"
BRIDGEDEV="bridge1"
#
ifconfig $BRIDGEDEV addm $TAPDEV

tap-down contains:
#!/bin/sh
#
TAPDEV="$1"
BRIDGEDEV="bridge1"
#
ifconfig $BRIDGEDEV deletem $TAPDEV

Best,
Cat_7
KCmacos
Space Cadet
Posts: 4
Joined: Sun Oct 27, 2019 2:51 pm

Re: Bridged network on macOS host (10.14.6 Mojave)

Post by KCmacos »

Hi Cat_7,

Thank you for your reply and very encouraging that it works for you!

I tried creating the bridge like you do in network preferences instead of ifconfig bridge1 create. I also added the tap-up/tap-down scripts. Still no luck. I only see traffic one way through the tap interface. This is what my interfaces look like after Qemu is up:

en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
ether 98:10:e8:f0:7b:b1
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
status: active
bridge1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 98:10:e8:f0:7b:b1
inet6 fe80::cb3:71a6:7e46:445d%bridge1 prefixlen 64 secured scopeid 0xd
inet 10.0.10.4 netmask 0xffffff00 broadcast 10.0.10.255
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en0 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 5 priority 0 path cost 0
member: tap0 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 14 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether f2:f3:62:2f:13:3a
media: autoselect
status: active
open (pid 2304)

Do you see anything here that differs from your setup?

I started Qemu with:

qemu-system-x86_64 -accel hvf -cpu host -m 512 -hda alpine.qcow2 -device e1000,netdev=network0 -netdev tap,id=network0,script=./scripts/tap-up,downscript=./scripts/tap-down

tap-up and tap-down look exactly like yours.

Regards,
KCmacos
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Bridged network on macOS host (10.14.6 Mojave)

Post by Cat_7 »

Hi,

Below the configuration with functional tap device. I tried x86_64 qemu with Alpine linux and Ubuntu 19. Both refused to get an ip-address from the DHCP server. I have no idea why.

en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
ether 3c:07:54:56:83:36
media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
status: active
bridge1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 3c:07:54:56:83:36
inet6 fe80::18ca:30d9:f083:982e%bridge1 prefixlen 64 secured scopeid 0xb
inet 192.168.0.24 netmask 0xffffff00 broadcast 192.168.0.255
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en0 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 6 priority 0 path cost 0
member: tap0 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 14 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether 2e:b3:b9:59:4b:0d
media: autoselect
status: active
open (pid 415)
KCmacos
Space Cadet
Posts: 4
Joined: Sun Oct 27, 2019 2:51 pm

Re: Bridged network on macOS host (10.14.6 Mojave)

Post by KCmacos »

Intriguing... At least I'm not crazy. Thanks for trying even if it doesn't solve my problem!

I also tried rebuilding x86_64 qemu from git as well as older version but with the same result.

I'll let you know if I find a solution...

Regards
KCmacos
Space Cadet
Posts: 4
Joined: Sun Oct 27, 2019 2:51 pm

Re: Bridged network on macOS host (10.14.6 Mojave)

Post by KCmacos »

For future reference or for anyone interested, the guys over at qemu-discuss found a solution. The qemu version from MacPorts works with bridged network. I haven't understood why yet but it does work.
Post Reply