---
title: attachment
framework: virtualization
role: symbol
role_heading: Instance Property
path: virtualization/vznetworkdevice/attachment
---

# attachment

The network attachment that’s connected to this network device.

## Declaration

```swift
var attachment: VZNetworkDeviceAttachment? { get set }
```

## Discussion

Discussion Setting this property results in an attempt to change the network device attachment which may fail. If the devices fails to attach, the system invokes virtualMachine(_:networkDevice:attachmentWasDisconnectedWithError:) and sets this property to nil. This property may change at any time while the VM is running based on the state of the host network.
