Run VPN server on iOS

I am trying to run a VPN server on iOS to redirect DNS traffic to my preferred DNS server. I understand Apple has provided TunnelServer in SimpleTunnelCustomizedNetworkingUsingtheNetworkExtensionFramework but it can be executed on OSX not iOS. What do I need to do to run the VPN server on iOS devices?

Accepted Reply

Please understand that under iOS, general purpose indefinite duration tasks are not supported. Your VPN server is going to die when its background process runs out of time. Any work around you find for this is going to be the result of misusing the existing background task system, and make the app you develop inelligible for submission to the App Store.


So you have two choices:

1. If you want a VPN server that is going to die when you put in the background, but that's okay because you're just using it to test things, then you can get a VPN server running on iOS. The results of this choice can be discussed here.

2. If you want a VPN server that isn't going to die when you put it in the background, you have to do things that either violate the Developer guidelines or use a non-standard iOS device. The results of this choice cannot be discussed here.


That's why Apple doesn't provide a VPN server for iOS devices.


On the other hand, you should be able to accomplish the task you've set out to do, redict DNS traffic to your preferred DNS server, by implementing an VPN client or creating a personal VPN configuration to use the specified DNS server.

Replies

Please understand that under iOS, general purpose indefinite duration tasks are not supported. Your VPN server is going to die when its background process runs out of time. Any work around you find for this is going to be the result of misusing the existing background task system, and make the app you develop inelligible for submission to the App Store.


So you have two choices:

1. If you want a VPN server that is going to die when you put in the background, but that's okay because you're just using it to test things, then you can get a VPN server running on iOS. The results of this choice can be discussed here.

2. If you want a VPN server that isn't going to die when you put it in the background, you have to do things that either violate the Developer guidelines or use a non-standard iOS device. The results of this choice cannot be discussed here.


That's why Apple doesn't provide a VPN server for iOS devices.


On the other hand, you should be able to accomplish the task you've set out to do, redict DNS traffic to your preferred DNS server, by implementing an VPN client or creating a personal VPN configuration to use the specified DNS server.

The similar application to what I want to achieve is DNSOverride in App Store. It creates a VPN connection in iOS settings using IKEv2 to 127.0.0.1. So, I assume they are running a local VPN server, right? Their App works even you close the application. What's missing here?

I've seen couple of similar applications which runs on 127.0.0.1.
Can anyone let me know how to do this.