iOS Network Extension : Local VPN
Asked Answered
C

0

0

I am trying to create a VPN, but without any VPN server. I am not sure if this is possible or not, but I Have seen apps which creates VPN and their VPN configuration ther server address is 127.0.0.1

I am using NEVPNProtocolIPSec

        let p = NEVPNProtocolIPSec()            
        p.username = "ScreenCoach"
        p.serverAddress = "MY_DEVICE_IP_ADDRESS"
        
        p.authenticationMethod = NEVPNIKEAuthenticationMethod.sharedSecret
        
        let kcs = KeychainService();
        kcs.save(key: "SHARED", value: "AppDemoKey")
        kcs.save(key: "VPN_PASSWORD", value: "rootuser")
        p.sharedSecretReference = kcs.load(key: "SHARED")
        p.passwordReference = kcs.load(key: "VPN_PASSWORD")
        p.useExtendedAuthentication = true
        p.disconnectOnSleep = false

In the serverAddress I have tried 127.0.0.1 , 0.0.0.0 and also my device's IP Address but nothing seems to work, and I am getting error alert message : The VPN server did not respond.

I don't know much about networking stuff, so can anyone please guide me here?

Thanks in advance.

EDIT

My Goal : Use custom DNS server for all the DNS queries throughout the device, without using an actual VPN server, so just a proxy VPN with DNS settings. Also I can not use NEDNSSettingsManager because iOS 12 is our minimum target.

Ceremonious answered 13/7, 2021 at 15:43 Comment(3)
What are you actually trying to accomplish with this serverless VPN?Morbidezza
@JamesZ actually I want my device to use a custom DNS server, which I am adding in On Demand Rules. I can't use NEDNSProxyProvider as this appraoch is for supervised devices, if I am not wrong.Ceremonious
@superGokuN: It is possible to use Packet Tunnel provider with empty match domains which should give you all DNS traffic and you can only add your DNS server in include routes which will eliminate any traffic not going to your DNS server from being received by your NE.Benzoic

© 2022 - 2024 — McMap. All rights reserved.