<!--
{
  "availability" : [
    "macCatalyst: 13.0 -",
    "macOS: 10.10 -"
  ],
  "documentType" : "symbol",
  "framework" : "vmnet",
  "identifier" : "/documentation/vmnet",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "vmnet"
    ],
    "preciseIdentifier" : "vmnet"
  },
  "title" : "vmnet"
}
-->

# vmnet

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

## Overview

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.

> Note: For more information about virtualization technologies, see the <doc://com.apple.documentation/documentation/Hypervisor> framework.

### Requirements

The vmnet framework has the following requirements:

#### Entitlements

A sandboxed user space process must have the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.vm.networking> entitlement in order to use the vmnet API.

### Architecture

![](images/com.apple.vmnet/media-2557515@2x.png)

The VM Network API provides support for an interface in the guest operating system. The API provides the MAC address and MTU that you need to be configure 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. The system drops packets sent from a different IPv4 address.

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

## Topics

### Essentials

  <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.vm.networking>

### Creating a network configuration

[`vmnet_network_create(_:_:)`](/documentation/vmnet/vmnet_network_create(_:_:))

Creates a vmnet network based on the provided configuration.

[`vmnet_network_configuration_create(_:_:)`](/documentation/vmnet/vmnet_network_configuration_create(_:_:))

Creates a network configuration object with the specified operating mode.

[`vmnet_network_create_with_serialization(_:_:)`](/documentation/vmnet/vmnet_network_create_with_serialization(_:_:))

Creates a vmnet network from an XPC object you obtained from calling the vmnet networkcopy serialization API.

[`vmnet_network_copy_serialization(_:_:)`](/documentation/vmnet/vmnet_network_copy_serialization(_:_:))

Serializes a vmnet network to an XPC object.

### Starting and stopping interfaces

[`vmnet_start_interface(_:_:_:)`](/documentation/vmnet/vmnet_start_interface(_:_:_:))

Starts a new virtual interface instance.

[`vmnet_interface_start_with_network(_:_:_:_:)`](/documentation/vmnet/vmnet_interface_start_with_network(_:_:_:_:))

Starts a new virtual interface instance on a network.

[`vmnet_interface_set_event_callback(_:_:_:_:)`](/documentation/vmnet/vmnet_interface_set_event_callback(_:_:_:_:))

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

[`vmnet_stop_interface(_:_:_:)`](/documentation/vmnet/vmnet_stop_interface(_:_:_:))

Stops I/O on the virtual interface.

### Customizing a network configuration

[`vmnet_network_configuration_ref`](/documentation/vmnet/vmnet_network_configuration_ref)

A reference to a network vmnet network configuration.

[`vmnet_network_configuration_add_dhcp_reservation(_:_:_:)`](/documentation/vmnet/vmnet_network_configuration_add_dhcp_reservation(_:_:_:))

Configures a new dhcp reservation for a vmnet network.

[`vmnet_network_configuration_add_port_forwarding_rule(_:_:_:_:_:_:)`](/documentation/vmnet/vmnet_network_configuration_add_port_forwarding_rule(_:_:_:_:_:_:))

Configures a new port forwarding rule for a vmnet network.

[`vmnet_network_configuration_disable_router_advertisement(_:)`](/documentation/vmnet/vmnet_network_configuration_disable_router_advertisement(_:))

Disables router advertisement on a network.

[`vmnet_network_configuration_disable_nat66(_:)`](/documentation/vmnet/vmnet_network_configuration_disable_nat66(_:))

Disables NAT66 on a network.

[`vmnet_network_configuration_disable_nat44(_:)`](/documentation/vmnet/vmnet_network_configuration_disable_nat44(_:))

Disables NAT44 on a network.

[`vmnet_network_configuration_disable_dns_proxy(_:)`](/documentation/vmnet/vmnet_network_configuration_disable_dns_proxy(_:))

Disables the DNS proxy on a network.

[`vmnet_network_configuration_disable_dhcp(_:)`](/documentation/vmnet/vmnet_network_configuration_disable_dhcp(_:))

Disables DHCP server on a network.

[`vmnet_nat66_prefix_length_key`](/documentation/vmnet/vmnet_nat66_prefix_length_key)

The IPv6 prefix (uint64) to use with vmnet shared mode.

[`vmnet_nat66_prefix_key`](/documentation/vmnet/vmnet_nat66_prefix_key)

The IPv6 prefix string to use with vmnet shared mode.

[`vmnet_port_forwarding_rule_get_details(_:_:_:_:_:)`](/documentation/vmnet/vmnet_port_forwarding_rule_get_details(_:_:_:_:_:))

Extracts port forwarding rule details from the rule XPC dictionary object.

[`vmnet_network_configuration_set_external_interface(_:_:)`](/documentation/vmnet/vmnet_network_configuration_set_external_interface(_:_:))

Configures the external interface of a vmnet network.

[`vmnet_network_configuration_set_ipv4_subnet(_:_:_:)`](/documentation/vmnet/vmnet_network_configuration_set_ipv4_subnet(_:_:_:))

Configures the IPv4 addresses of a vmnet network.

[`vmnet_network_configuration_set_ipv6_prefix(_:_:_:)`](/documentation/vmnet/vmnet_network_configuration_set_ipv6_prefix(_:_:_:))

Configures the IPv6 prefix for a vmnet network object.

[`vmnet_network_configuration_set_mtu(_:_:)`](/documentation/vmnet/vmnet_network_configuration_set_mtu(_:_:))

Configures the maximum transmission unit (MTU) for a vmnet network.

[`vmnet_network_get_ipv6_prefix(_:_:_:)`](/documentation/vmnet/vmnet_network_get_ipv6_prefix(_:_:_:))

Returns the IPv6 prefix of a network.

[`vmnet_network_get_ipv4_subnet(_:_:_:)`](/documentation/vmnet/vmnet_network_get_ipv4_subnet(_:_:_:))

Returns the IPv4 subnet of a network.

### Reading and Writing Packets

[`vmnet_read(_:_:_:)`](/documentation/vmnet/vmnet_read(_:_:_:))

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

[`vmnet_write(_:_:_:)`](/documentation/vmnet/vmnet_write(_:_:_:))

Attempts to write specified packets to an interface.

### Data types

[`vmnet_return_t`](/documentation/vmnet/vmnet_return_t)

Values returned by functions in the vmnet Framework.

[`vmpktdesc`](/documentation/vmnet/vmpktdesc)

Describes a packet.

[`interface_ref`](/documentation/vmnet/interface_ref)

A virtual network interface.

[`interface_event_t`](/documentation/vmnet/interface_event_t)

Interface event types.

[`operating_modes_t`](/documentation/vmnet/operating_modes_t)

The operating modes for an interface.

[`vmnet_mode_t`](/documentation/vmnet/vmnet_mode_t)

A type that defines the operating modes of the vmnet interface.

[`vmnet_network_ref`](/documentation/vmnet/vmnet_network_ref)

A pointer to a network structure.

### Constants

[interface_desc XPC Dictionary Keys](/documentation/vmnet/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](/documentation/vmnet/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](/documentation/vmnet/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.

### Reference

[vmnet Constants](/documentation/vmnet/vmnet_constants)

[vmnet Functions](/documentation/vmnet/vmnet_functions)

[vmnet Data Types](/documentation/vmnet/vmnet_data_types)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)
