Configure NAT-network For QEMU On macOS Mojave GitHub
Configure NAT-network For QEMU On macOS Mojave GitHub
Code Revisions
17 Stars
2
https://gist.github.com/andriytk/bd3def8c30cbd474490280436c779027 1/5
28/12/2021, 17:29 Configure NAT-network for QEMU on macOS Mojave · GitHub
https://gist.github.com/andriytk/bd3def8c30cbd474490280436c779027 2/5
28/12/2021, 17:29 Configure NAT-network for QEMU on macOS Mojave · GitHub
2. Turn On Internet Sharing with the created bridge via System Preferences ->
Sharing:
Now you are ready to start qemu, just add -nic tap option
for the NAT-interface.
After the VM is started, tapN interface
will appear in the host. Add it to the bridge:
sudo ifconfig bridge0 addm tapN
For the convenience, you can create the following two scripts
which qemu will run by
default for tap network interfaces for each VM.
The scripts add and remove the tapN-
interface to/from the bridge.
Otherwise, you will have to do this manually for each VM.
Here are the scripts:
$ cat /opt/local/etc/qemu-ifup
#!/bin/sh
TAPDEV="$1"
BRIDGEDEV="bridge0"
https://gist.github.com/andriytk/bd3def8c30cbd474490280436c779027 3/5
28/12/2021, 17:29 Configure NAT-network for QEMU on macOS Mojave · GitHub
$ cat /opt/local/etc/qemu-ifdown
#!/bin/sh
TAPDEV="$1"
BRIDGEDEV="bridge0"
Bummer! Thought there was more magic behind. Cannot seem to get this working for a Raspberry P.
Emulation boots but has no network connection.
error:
qemu-system-aarch64: warning: netdev #net088 has no peer
https://gist.github.com/andriytk/bd3def8c30cbd474490280436c779027 4/5
28/12/2021, 17:29 Configure NAT-network for QEMU on macOS Mojave · GitHub
-m 1G \
-M raspi3b \
-smp 4 \
-usb \
-device usb-mouse \
-device usb-kbd \
-device 'usb-net,netdev=net0' \
-netdev 'user,id=net0,hostfwd=tcp::5022-:22' \
-drive "file=2020-08-20-raspios-buster-armhf-lite.img,index=0,format=raw" \
-dtb bcm2710-rpi-3-b-plus.dtb \
-kernel kernel8.img \
-no-reboot \
-nographic \
-nic tap
https://gist.github.com/andriytk/bd3def8c30cbd474490280436c779027 5/5