# The problem about VPN(IKEv2) with Win10 Mobile



## 0oVicero0 (Jun 15, 2016)

L2TP work as well.                                  
 IKEv2 not route , and can not get the vaild IP address.                                       
Can anyone solve this problem?


----------



## ngame (Jun 15, 2016)

0oVicero0 said:


> L2TP work as well.
> IKEv2 not route , and can not get the vaild IP address.
> Can anyone solve this problem?

Click to collapse



are you on Redstone build ?
seems VPN broken on Redstone , not only IKEV2


----------



## DLS123 (Jun 15, 2016)

It's working fine for me. IKEv2 IPsec, Strongswan server. 
Requires editing the connections file on the phone, though. Windows 10 mobile (same for PC) will not use the default route provided by the VPN server and there is no toggle to send all the traffic through the VPN like there was on Windows Phone 8/8.1 in the VPN connection settings GUI. 
So, 'IpPrioritizeRemote=1' has to be set manually for the connection in rasphone.pbk on the phone. This can be achieved and requires an NTFS formatted SD card with the modified rasphone.pbk and a symbolic link to 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections' (you can make this symbolic link on the PC). 
First you have to create a VPN connection on the phone, then delete it. This will make 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections\Pbk\' user writable and you can put a modified rasphone.pbk file in that location by accessing it through the symbolic link on the SD card. 
If you don't know how to make the rasphone.pbk file, first configure the connection as it should be on the phone, then copy rasphone.pbk from the phone, edit it on PC and add 'IpPrioritizeRemote=1'. Delete the VPN connection from the phone, and put the modified rasphone file in its place. 
Reboot might be required after copying the file manually. 

^ This is for phones that can't be interop unlocked like my Lumia 950XL. It's much easier for other phones which can be unlocked and full FS access is achievable. 

Pretty stupid omission on Microsoft's part. I've been shouting about it on windows feedback since Windows 10 Mobile was released to insiders, but no one listens.


----------



## w.bogdan (Jun 16, 2016)

VPN is broken in Windows 10. Period! Microsoft it's not going to fix it.


----------



## DLS123 (Jun 16, 2016)

w.bogdan said:


> VPN is broken in Windows 10. Period! Microsoft it's not going to fix it.

Click to collapse




No period. It's broken, but it can be made to work. Who put you in charge of dropping the period?


----------



## w.bogdan (Jun 16, 2016)

DLS123 said:


> No period. It's broken, but it can be made to work. Who put you in charge of dropping the period?

Click to collapse



Search for "Windows 10 DNS resolution" or other VPN related issues in Windows 10. It's not a bug, it's a feature ... for NSA, the government of China and so on.


----------



## DLS123 (Jun 16, 2016)

w.bogdan said:


> Search for "Windows 10 DNS resolution" or other VPN related issues in Windows 10. It's not a bug, it's a feature ... for NSA, the government of China and so on.

Click to collapse



I know about it and took measures against it. They call it Smart multi-homed name resolution. It can be disabled on Desktop and also the order of DNS servers used can be set for each VPN connection. This isn't really caused by the broken built-in VPN client, but the way Windows 10 itself works out of the box.


----------



## w.bogdan (Jun 17, 2016)

DLS123 said:


> I know about it and took measures against it. They call it Smart multi-homed name resolution. It can be disabled on Desktop and also the order of DNS servers used can be set for each VPN connection. This isn't really caused by the broken built-in VPN client, but the way Windows 10 itself works out of the box.

Click to collapse



It's not just desktop. On W10M, DNS leaks, VPN connected icon is barely visible and you don't get notified if the VPN connection drops. Is hard to believe Satya Nadella is so dumb not to notice.


----------



## DLS123 (Jun 17, 2016)

w.bogdan said:


> It's not just desktop. On W10M, DNS leaks, VPN connected icon is barely visible and you don't get notified if the VPN connection drops. Is hard to believe Satya Nadella is so dumb not to notice.

Click to collapse



I know there are DNS leaks on W10Mobile and multi-homing can't be disabled, but I don't have a problem with that. The purpose of VPN for me is to gain access to other private networks and encrypt the communication with them. DNS leaks aren't that critical. It's not like I don't want my employer to know what websites I access while connecting to VPNs from their network. I couldn't care less to be honest that they're logging my DNS querries. And I also don't live in China.

Even if they have my DNS records they still won't ever be able to break the encrypted IPsec tunnels and get any glimpse of what's passing through them.


----------



## joellinn (Jul 5, 2016)

Wasn't able to download rasphone.pbk from the phone but could upload one.
I used my Windows 10 PC and created the connections there. Then I *disabled* IpPrioritizeRemote and used the powershell cmdlet Add-VpnConnectionRoute to add a route to the pbk file pointing to my local subnet.
I am now able to connect to the internet and access corporate resources at the same time. 
I however couldn't connect from one particular app which worked in 8.1. There may be issues with non universal apps.


----------



## 0oVicero0 (Jul 11, 2016)

DLS123 said:


> It's working fine for me. IKEv2 IPsec, Strongswan server.
> Requires editing the connections file on the phone, though. Windows 10 mobile (same for PC) will not use the default route provided by the VPN server and there is no toggle to send all the traffic through the VPN like there was on Windows Phone 8/8.1 in the VPN connection settings GUI.
> So, 'IpPrioritizeRemote=1' has to be set manually for the connection in rasphone.pbk on the phone. This can be achieved and requires an NTFS formatted SD card with the modified rasphone.pbk and a symbolic link to 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections' (you can make this symbolic link on the PC).
> First you have to create a VPN connection on the phone, then delete it. This will make 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections\Pbk\' user writable and you can put a modified rasphone.pbk file in that location by accessing it through the symbolic link on the SD card.
> ...

Click to collapse




Thanks!!! It's working fine!
I think Microsoft do not want to fix it.


----------



## DLS123 (Jul 12, 2016)

0oVicero0 said:


> I think Microsoft do not want to fix it.

Click to collapse



Yeah, looks like that's the case. There is very little feedback in insider hub about VPN problems. Very few care about these issues so probably MS has no incentive to fix and prefer to rely on MDM for VPN configuration on these devices. Now if only that were an option for mere mortals...


----------



## rlively (Sep 6, 2016)

*How to import self-signed key or export builtin cert for a strongswan server?*



DLS123 said:


> It's working fine for me. IKEv2 IPsec, Strongswan server.

Click to collapse



How did you get the VPN connection set up properly (aside from the IpPrioritizeRemote setting)?

I've set up a strongswan server and generated my own self-signed keys using ipsec pki, but when I import the key to my Lumia 1520 (by tapping it using the Files app and tapping import at the prompt), the VPN connection will not send that cert. Instead it sends a certificate issued by CN=Microsoft Genuine Windows Phone CA15" with an OU that looks like a GUID.

So I tried punting and just exporting that certificate to place on my strongswan server ... but I can't figure out how to get the certificate off the phone either. So how do I do either one?


----------



## DLS123 (Sep 11, 2016)

rlively said:


> How did you get the VPN connection set up properly (aside from the IpPrioritizeRemote setting)?
> 
> I've set up a strongswan server and generated my own self-signed keys using ipsec pki, but when I import the key to my Lumia 1520 (by tapping it using the Files app and tapping import at the prompt), the VPN connection will not send that cert. Instead it sends a certificate issued by CN=Microsoft Genuine Windows Phone CA15" with an OU that looks like a GUID.
> 
> So I tried punting and just exporting that certificate to place on my strongswan server ... but I can't figure out how to get the certificate off the phone either. So how do I do either one?

Click to collapse



I don't know what self generated certificate your phone sends, but you shouldn't use that. 
You should generate a client certificate on the strongswan server then you should include both the root CA and the client certificate and pack them together in a PKCS 12 file (.p12) which you open on the phone and import. The phone will choose the proper certificate stores to import to. Did you do that? 
https://www.zeitgeist.se/2013/11/22/strongswan-howto-create-your-own-vpn/
Just follow this tutorial., with the only mention that you should add "--flag clientAuth" to the command line for generating the client certificate.


----------



## rlively (Sep 13, 2016)

DLS123 said:


> I don't know what self generated certificate your phone sends, but you shouldn't use that.
> You should generate a client certificate on the strongswan server then you should include both the root CA and the client certificate and pack them together in a PKCS 12 file (.p12) which you open on the phone and import. The phone will choose the proper certificate stores to import to. Did you do that?
> Just follow this tutorial., with the only mention that you should add "--flag clientAuth" to the command line for generating the client certificate.

Click to collapse



Thanks, that is a good tutorial - I definitely did not use the clientAuth flag (the ipsec tutorial for openWRT didn't include it: openwrt doc/howto/vpn.ipsec.roadwarrior), so I tried generating new certs with clientAuth. Unfortunately I got the same results. My Win10 phone sent the same "Microsoft Genuine Windows Phone CA15" cert.

Did you import the PKCS 12 file just by tapping it in the Microsoft "Files" app on the phone or did you use another method? I'm verifying the certs with the Microsoft "Certificates" app, which does show that the original cert I generated has no "Enhanced usages" but the second has "Client Authentication." Still the builtin VPN client won't pick it to send to my strongSwan server.

I did away completely with my configuration and started over with the win7 configuration here: strongswan wiki: Win7CertReq but none of it will help if I can't get my phone to actually send the correct certificate ... this configuration did something a little different though:

My phone sent the correct certificate in the "received TLS peer certificate" line followed by these error messages:

no trusted certificate found for 'my-CN-here' to verify TLS peer
sending fatal TLS alert 'certificate unknown'

Despite the fact that I have the certificate pem in /etc/ipsec.d/certs ... 

in any case it continues on and sends the Microsoft cert afterwards and then the server throws "no peer config found" (since I don't have the public cert loaded for that MS cert).

Followed up on the error here: strongswan wiki /issues/785

I also tried it with "eap_identity=%identity" instead of "eap_identity=%any".

Frustrating that it works great for Win7 but I just can't get a Win10 phone working. Any guides out there specifically for Windows phone + Strongswan?


----------



## DLS123 (Sep 18, 2016)

rlively said:


> Thanks, that is a good tutorial - I definitely did not use the clientAuth flag (the ipsec tutorial for openWRT didn't include it: openwrt doc/howto/vpn.ipsec.roadwarrior), so I tried generating new certs with clientAuth. Unfortunately I got the same results. My Win10 phone sent the same "Microsoft Genuine Windows Phone CA15" cert.
> 
> Did you import the PKCS 12 file just by tapping it in the Microsoft "Files" app on the phone or did you use another method? I'm verifying the certs with the Microsoft "Certificates" app, which does show that the original cert I generated has no "Enhanced usages" but the second has "Client Authentication." Still the builtin VPN client won't pick it to send to my strongSwan server.
> 
> ...

Click to collapse



I import the certificates from file explorer on phone or from the OneDrive app, doesn't matter. 

Have you actually set the EAP identity correctly in the client certificate? CN has to be exactly the same as --san 
That's the eap_identity which has to be known if you use EAP-TLS. 

I don't know what else to say, maybe post your ipsec.conf with censored IPs


----------



## rlively (Sep 26, 2016)

DLS123 said:


> I import the certificates from file explorer on phone or from the OneDrive app, doesn't matter.
> 
> Have you actually set the EAP identity correctly in the client certificate? CN has to be exactly the same as --san
> That's the eap_identity which has to be known if you use EAP-TLS.
> ...

Click to collapse



For the moment I just have mschap authentication with no certificate and it works. The certificate is just giving me fits.

On my client certificate my CN is not the same as the san.  My san is set to the FQDN of my VPN server ... the CN of my client certificate is an identifier for my client.

What does the VPN server use for eap_identity - the CN from the client certificate when set to eap_identity=%identity ?

---------- Post added at 10:01 PM ---------- Previous post was at 09:35 PM ----------




rlively said:


> For the moment I just have mschap authentication with no certificate and it works. The certificate is just giving me fits.
> 
> On my client certificate my CN is not the same as the san.  My san is set to the FQDN of my VPN server ... the CN of my client certificate is an identifier for my client.
> 
> What does the VPN server use for eap_identity - the CN from the client certificate when set to eap_identity=%identity ?

Click to collapse



My server certificate does have a CN and san that match. I thought I read somewhere that having that same value in the client san would help the client match up the cert to send to the server, at least for Windows Phone. Of course I can't find that guide now, so maybe I misread. I do see that in the example on https://www.zeitgeist.se/2013/11/22/strongswan-howto-create-your-own-vpn/ that the server CN and san match and the client CN and san match each other.


----------



## DLS123 (Oct 12, 2016)

In the client certificate you should have [email protected]_FQDN --san server_FQDN --flag clientAuth
the eap_identity used by strongswan is the part before @ from CN.
It won't match anything when using eap_idenity=%identity if you don't do it like this.


----------



## user107 (Dec 8, 2016)

Are there any relevant registry files we can access with interop tools?


----------



## letalis (Jan 13, 2017)

DLS123 said:


> It's working fine for me. IKEv2 IPsec, Strongswan server.
> Requires editing the connections file on the phone, though. Windows 10 mobile (same for PC) will not use the default route provided by the VPN server and there is no toggle to send all the traffic through the VPN like there was on Windows Phone 8/8.1 in the VPN connection settings GUI.
> So, 'IpPrioritizeRemote=1' has to be set manually for the connection in rasphone.pbk on the phone. This can be achieved and requires an NTFS formatted SD card with the modified rasphone.pbk and a symbolic link to 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections' (you can make this symbolic link on the PC).
> First you have to create a VPN connection on the phone, then delete it. This will make 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections\Pbk\' user writable and you can put a modified rasphone.pbk file in that location by accessing it through the symbolic link on the SD card.
> ...

Click to collapse



Hi I tried your manual, unfortunately without any success 

If I Read it correctly you do the following steps:
1) Format sd card on NTFS
2) On the sd card create symbolic link to: C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections
3) Insert sd in phone
4) Create a vpn connection on the phone
5) Delete al the vpn connections on the phone
6) Use the phone to put a new (modified) rasphone.pbk file on the sd card (though onedrive??). I cant access my sd om my pc when usb is connected
7) Reboot the phone
8) Make a new vpn connection (can it have a different name?)

Can someone verify if i miss something?

I'll be very happy if this works


----------



## QuaintJade (Mar 26, 2017)

DLS123 said:


> It's working fine for me. IKEv2 IPsec, Strongswan server.
> Requires editing the connections file on the phone, though. Windows 10 mobile (same for PC) will not use the default route provided by the VPN server and there is no toggle to send all the traffic through the VPN like there was on Windows Phone 8/8.1 in the VPN connection settings GUI.
> So, 'IpPrioritizeRemote=1' has to be set manually for the connection in rasphone.pbk on the phone. This can be achieved and requires an NTFS formatted SD card with the modified rasphone.pbk and a symbolic link to 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections' (you can make this symbolic link on the PC).
> First you have to create a VPN connection on the phone, then delete it. This will make 'C:\Data\USERS\DefApps\APPDATA\ROAMING\MICROSOFT\Network\Connections\Pbk\' user writable and you can put a modified rasphone.pbk file in that location by accessing it through the symbolic link on the SD card.
> ...

Click to collapse



Thanks for the solution. It really works, but with some bug:
* after successfully connected to VPN, the VPN status still appears unconnected (it's actually connected). The problem is that I cannot disconnect it unless rebooting the phone.

If I create a VPN in phone Settings GUI, there's no such problem. So I guess there is some subtle difference between the rasphone.pbk .

Would you please send me a sample rasphone.pbk created through Settings GUI? Preferrably with certificate login method. Thanks!.

I just deleted VPNs, rebooted, copied rasphone.pbk again, rebooted, then all things are fine. So the trick is to reboot after each operation.
Thanks anyway


----------



## saarakura (Mar 28, 2017)

QuaintJade said:


> Thanks for the solution. It really works, but with some bug:
> * after successfully connected to VPN, the VPN status still appears unconnected (it's actually connected). The problem is that I cannot disconnect it unless rebooting the phone.
> 
> If I create a VPN in phone Settings GUI, there's no such problem. So I guess there is some subtle difference between the rasphone.pbk .
> ...

Click to collapse



Where can i find this modified rasphone.pbk ?


----------



## QuaintJade (Apr 8, 2017)

saarakura said:


> Where can i find this modified rasphone.pbk ?

Click to collapse



If you have Windows 10 desktop, you can create VPN and copy the rasphone.pbk to your phone.
The dir in desktop windows is %APPDATA%\Microsoft\Network\Connections\Pbk

But *.Vicer* has provided an even better solution.
Source: bbs.wfun.com/thread-953430-1-1.html


Create the VPN in your phone.
Download this modified .lnk file and copy it to your phone.
drive.google.com/open?id=0BxHd9qH1dFLheTlTUS1FRVdYREE
Rename the extension from _@rasphone.lnk.db_ to _@rasphone.lnk_ , so that it will become a shortcut to actual rasphone.pbk .
Install a good text editor (e.g. NotepadX).
Edit the above shortcut and change _IpPrioritizeRemote=0_ to _IpPrioritizeRemote=1_. You may also change _IpInterfaceMetric_ to _IpInterfaceMetric=15_ or smaller number to workaround possible DNS leak.


----------



## saarakura (Apr 8, 2017)

QuaintJade said:


> If you have Windows 10 desktop, you can create VPN and copy the rasphone.pbk to your phone.
> The dir in desktop windows is %APPDATA%\Microsoft\Network\Connections\Pbk
> 
> But *.Vicer* has provided an even better solution.
> ...

Click to collapse



Very thanks! i will try it


----------



## saarakura (Apr 9, 2017)

QuaintJade said:


> If you have Windows 10 desktop, you can create VPN and copy the rasphone.pbk to your phone.
> The dir in desktop windows is %APPDATA%\Microsoft\Network\Connections\Pbk
> 
> But *.Vicer* has provided an even better solution.
> ...

Click to collapse



On this part "[*]Rename the extension from _@rasphone.lnk.db_ to _@rasphone.lnk.db_ , so that it will become a shortcut to actual rasphone.pbk ."
i cant see any diference to rename. the names are the same 0o


----------



## QuaintJade (Apr 9, 2017)

saarakura said:


> On this part "[*]Rename the extension from _@rasphone.lnk.db_ to _@rasphone.lnk.db_ , so that it will become a shortcut to actual rasphone.pbk ."
> i cant see any diference to rename. the names are the same 0o

Click to collapse



Oops, it should be "rename the extension to _@rasphone.lnk_" .  
_.lnk_ is the the hidden extension of Windows shortcut.


----------



## Neighborhoodhiphop (Oct 9, 2017)

Hello sir,
I have been reading through your posts here regarding the Windows phone 10 problems with VPN and it seems you are a professional techno.
Please i need your assistance with Lumia 1520 VPN problems. I live China and amongst several blocked sites, they have just blocked WhatsApp. I was able to Connect the VPN, but since last week, no VPN is working for windows phone. And i can't just switch to Android overnight. I need to migrate normally all communication or save them.
So i need your urgent help with the VPN connection editing. for Lumia 1520. How do i start? I can be reached at neighborhoodhiphop (at) yahoo (.) com. Thanks


----------

