Connect with network interfaces to read and write packets on guest operating systems.


The vmnet framework is an API for virtual machines to read and write packets.

The API allows a Guest OS interface to be in host mode or shared mode. Interfaces in host mode can communicate with the native host system and other interfaces running in host mode. In shared mode, the network interface can send and receive packets to the Internet, the native host, and other interfaces running in sharing mode.


The vmnet framework has the following requirements:


A sandboxed user space process must have the entitlement in order to use vmnet API.


Figure 1

vmnet Architecture

The VM Network API provides support for an interface in the guest operating system. The API provides the MAC address and MTU that needs to be configured on the guest OS interface. The interface receives a private IPv4 address via DHCP. IPv4 traffic originating from the guest operating system must use the private IPv4 address. Packets sent from a different IPv4 address are dropped by the system.

You can create a maximum of 32 interfaces with a limit of 4 per guest operating system. Each read/write call allows up to 200 packets to be read or written for a maximum of 256KB. Each packet written should be a complete ethernet frame.


Starting and Stopping Interfaces


Starts host or shared mode on an interface with a specified configuration.


Schedules a callback to be executed when events for the specified interface are received.


Stops the interface.

Reading and Writing Packets


Attempts to read a specified number of packets from an interface.


Attempts to write specified packets to an interface.

Data Types


Values returned by functions in the vmnet Framework.


Describes a packet.


A virtual network interface.


Interface event types.


The operating modes for an interface.


interface_desc XPC Dictionary Keys

XPC dictionary keys supported by the interface_desc parameter passed to the vmnet function to describe the parameters of the network interface.

interface_param XPC Dictionary Keys

XPC dictionary keys used by the interface_param argument returned by the completion handler of the vmnet function that describes the parameters that should be used to configure the network interface.

event XPC Dictionary

XPC dictionary keys used by the event value returned to the client in the handler callback specified by the vmnet function that provides information about the callback event.