19

I'm trying to build an iOS app that lists all requests that are made from the device, like Charles Proxy does. Much like Charles, my idea has been to create a Packet Tunnel Provider and have it setup a local VPN connection without an external VPN server. The traffic would then be internally routed to the packet tunnel, without requiring an external VPN server.

Since Charles Proxy does so, I know that it is technically possible, but I can't find any information about how to setup a tunnel with an internal VPN connection, instead of using a "real" external VPN server. The only resource people refers to is the SimpleTunnel Apple sample project, which is a couple years old and written in Swift 3.

I have downloaded the SimpleTunnel sample code project, created the correct entitlements and can now run the project and create a VPN configuration that gets listed under Settings, but I just can't connect the VPN tunnel. I have tried changing the server address to 127.1.0.0 and to use IKEv2, but without success. I have also downloaded the source code at https://github.com/lxdcn/NEPacketTunnelVPNDemo but didn't get it to work either.

Does anyone know how to setup an internal VPN server with NetworkExtensions and have the tunnel use that connection?

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
Daniel Saidi
  • 6,079
  • 4
  • 27
  • 29
  • 4
    That's what this master thesis explains https://nsg.ee.ethz.ch/fileadmin/user_upload/theses/MA-2016-47.pdf – Ricardo Jun 11 '18 at 15:49
  • [NEPacketTunnelVPNDemo](https://github.com/lxdcn/NEPacketTunnelVPNDemo) this one will work with external VPN server basically you will have to run [Simple VPN Demo Server Code](https://github.com/lxdcn/simple-vpn-demo) on linux machine and copy over the IP address of linux machine to viewcontroller.swift then you can connect but this project is not about creating a VPN connection without any external VPN server – Durai Amuthan.H Nov 13 '18 at 19:40
  • @DuraiAmuthan.H Have you done the internal VPN server with NetworkExtension? – Vlad Dec 02 '18 at 05:40
  • @Vladislav - You mean [NEPacketTunnelVPNDemo](https://github.com/lxdcn/NEPacketTunnelVPNDemo).I wasn't aware it has internal VPN server. – Durai Amuthan.H Dec 05 '18 at 16:09
  • 1
    Did you achieve success in your research, Daniel? I'm currently looking for the same solution and stuck on the same challenge. – OdNairy Apr 11 '19 at 12:45
  • Have you made any progress here? – wheresmycookie Jun 15 '19 at 17:50
  • let setting = NEPacketTunnelNetworkSettings(tunnelRemoteAddress:vpnServer ) , then config setting, after this ,provier call setTunnelNetworkSettings.if no params error ,VPN connected. read/write packets or startup http server, setup NEProxyServer, http request will connect local http server. – loader Nov 21 '19 at 03:31
  • I haven't worked with this anymore. – Daniel Saidi Nov 21 '19 at 08:30
  • @OdNairy any update from your side? – Omarj Apr 20 '20 at 20:15
  • @wheresmycookie any luck ? – Omarj Apr 20 '20 at 20:15
  • @Omarj Unfortunately, no. – OdNairy Apr 22 '20 at 08:22
  • @Ricardo how can I reach those guys ? I have some questions regarding there solution. For example what happened to the packet if u decided to not write it to your session? it will be dropped and the user gets bad access or something like that or it will goes back to normal network layers ? without VPN tunnel – Omarj Apr 24 '20 at 10:48

0 Answers0