<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NETunnelProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NETunnelProvider"
  },
  "title" : "NETunnelProvider"
}
-->

# NETunnelProvider

An abstract base class shared by NEPacketTunnelProvider and NEAppProxyProvider.

```
class NETunnelProvider
```

## Overview

Each [`NETunnelProvider`](/documentation/NetworkExtension/NETunnelProvider) instance corresponds to a single tunneling session, with a single associated configuration.

> Important:
> The `com.apple.developer.networking.networkextension` entitlement is required in order to use the ``doc://com.apple.networkextension/documentation/NetworkExtension/NETunnelProvider`` class. Enable this entitlement when creating an App ID in your developer account.

### Subclassing Notes

The `NETunnelProvider` class should not be subclassed directly. Instead, you should create subclasses of `NETunnelProvider` subclasses.

#### Methods to Override

- [`handleAppMessage(_:completionHandler:)`](/documentation/NetworkExtension/NETunnelProvider/handleAppMessage(_:completionHandler:))

## Topics

### Getting the tunnel configuration

[`protocolConfiguration`](/documentation/NetworkExtension/NETunnelProvider/protocolConfiguration)

The configuration of the current tunneling session.

[`routingMethod`](/documentation/NetworkExtension/NETunnelProvider/routingMethod)

The method by which network traffic is routed to the tunnel.

[`appRules`](/documentation/NetworkExtension/NETunnelProvider/appRules)

The app rules dictating which apps use the current tunneling session.

### Configuring the tunnel interface

[`-  setTunnelNetworkSettings:completionHandler:`](/documentation/NetworkExtension/NETunnelProvider/setTunnelNetworkSettings(_:completionHandler:))

Specify the network settings for the current tunneling session.

### Communicating with the containing app

[`-  handleAppMessage:completionHandler:`](/documentation/NetworkExtension/NETunnelProvider/handleAppMessage(_:completionHandler:))

Handle messages sent by the tunnel provider extension’s containing app.

### Setting tunnel status

[`reasserting`](/documentation/NetworkExtension/NETunnelProvider/reasserting)

Indicate to the system that the tunnel is being re-established.

### Errors

[`Code`](/documentation/NetworkExtension/NETunnelProviderError-swift.struct/Code)

Error codes that the tunnel provider declares.

[`NETunnelProviderErrorDomain`](/documentation/NetworkExtension/NETunnelProviderErrorDomain)

The domain used for Tunnel Provider errors.

[`Code`](/documentation/NetworkExtension/NETunnelProviderError-swift.struct/Code)

Error codes that the tunnel provider declares.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

### Inherited By

[`NEAppProxyProvider`](/documentation/NetworkExtension/NEAppProxyProvider)

[`NEPacketTunnelProvider`](/documentation/NetworkExtension/NEPacketTunnelProvider)

### Inherits From

[`NEProvider`](/documentation/NetworkExtension/NEProvider)

---

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)