<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZNetworkDevice/attachment",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZNetworkDevice(py)attachment"
  },
  "title" : "attachment"
}
-->

# attachment

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

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

## 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:)`](/documentation/Virtualization/VZVirtualMachineDelegate/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.

---

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)