Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support macOS native networking #33

Open
jserv opened this issue Oct 2, 2023 · 0 comments
Open

Support macOS native networking #33

jserv opened this issue Oct 2, 2023 · 0 comments

Comments

@jserv
Copy link
Collaborator

jserv commented Oct 2, 2023

akihikodaki's patch set includes support for vmnet which offers more flexibility than -netdev user, and allows higher network throughput. (see akihikodaki/qemu@72a35bb).

Take QEMU for example. To enable bridge mode, replace:

    -device virtio-net-pci,netdev=net \
    -netdev user,id=net,ipv6=off \

with

    -netdev vmnet-macos,id=n1,mode=bridged,ifname=en0 \
    -device virtio-net,netdev=n1 \

vmnet also offers "host" and "shared" networking model:

   -netdev vmnet-macos,id=str,mode=host|shared[,dhcp_start_address=addr,dhcp_end_address=addr,dhcp_subnet_mask=mask]

caveats:

  1. vmnet requires running qemu as root, for now.
  2. current vmnet API (Apple) doesn't support setting MAC address, so it will be randomized every time the VM is started.
    To work around 2), for now it's possible to set the MAC address within the VM.

As root, create a file /etc/udev/rules.d/75-mac-vmnet.rules with the following content:

ACTION=="add", SUBSYSTEM=="net", KERNEL=="enp0s3", RUN+="/usr/bin/ip link set dev %k address 00:11:22:33:44:55"
replace enp0s3 with the name of your interface and 00:11:22:33:44:55 with the desired MAC address.

Reboot or issue a ip link set dev enp0s3 address 00:11:22:33:44:55 to change your MAC address.

Reference: macos-vmnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant