<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZFileHandleNetworkDeviceAttachment",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZFileHandleNetworkDeviceAttachment"
  },
  "title" : "VZFileHandleNetworkDeviceAttachment"
}
-->

# VZFileHandleNetworkDeviceAttachment

A network device that transmits raw network packets and frames using a datagram socket.

```
class VZFileHandleNetworkDeviceAttachment
```

## Overview

A [`VZFileHandleNetworkDeviceAttachment`](/documentation/Virtualization/VZFileHandleNetworkDeviceAttachment) object maps a network interface to a connected datagram socket. This attachment transmits data at the data link layer. You configure and manage the socket in your app, and manage the corresponding data transfers.

To configure a network device with a socket-based file handle:

1. Create a socket with the `SOCK_DGRAM` type in your app.
2. Create a <doc://com.apple.documentation/documentation/Foundation/FileHandle> from the socket’s file descriptor.
3. Create the [`VZFileHandleNetworkDeviceAttachment`](/documentation/Virtualization/VZFileHandleNetworkDeviceAttachment) object using the file handle.
4. Assign the attachment object to the [`attachment`](/documentation/Virtualization/VZNetworkDeviceConfiguration/attachment) property of a [`VZVirtioNetworkDeviceConfiguration`](/documentation/Virtualization/VZVirtioNetworkDeviceConfiguration) object.
5. Add the [`VZVirtioNetworkDeviceConfiguration`](/documentation/Virtualization/VZVirtioNetworkDeviceConfiguration) object to the [`networkDevices`](/documentation/Virtualization/VZVirtualMachineConfiguration/networkDevices) property of your [`VZVirtualMachineConfiguration`](/documentation/Virtualization/VZVirtualMachineConfiguration).

This attachment doesn’t require your app to have the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.vm.networking> entitlement.

## Topics

### Creating the attachment point

[`init(fileHandle:)`](/documentation/Virtualization/VZFileHandleNetworkDeviceAttachment/init(fileHandle:))

Creates the attachment from a file handle that contains a connected datagram socket.

### Getting the file handle

[`fileHandle`](/documentation/Virtualization/VZFileHandleNetworkDeviceAttachment/fileHandle)

The file handle assigned to this attachment.

### Specifying the network packet size

[`maximumTransmissionUnit`](/documentation/Virtualization/VZFileHandleNetworkDeviceAttachment/maximumTransmissionUnit)

An integer value that indicates the maximum transmission unit (MTU) associated with this attachment.



---

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)