How to Connect to a VPN in iOS Swift?

Can't connect to VPN via iOS

  • I have set up a Mac OS X 10.8 server running the VPN service. From my Macs I can connect to the VPN server without any problems, but the iOS devices are all unable to connect. The console displays the following message while trying to connect an iPhone: 9/8/13 11:02:51.704 AM racoon[313]: Connecting. 9/8/13 11:02:51.704 AM racoon[313]: IPSec Phase1 started (Initiated by peer). 9/8/13 11:02:51.706 AM racoon[313]: IKE Packet: receive success. (Responder, Main-Mode message 1). 9/8/13 11:02:51.706 AM racoon[313]: IKE Packet: transmit success. (Responder, Main-Mode message 2). 9/8/13 11:02:51.771 AM racoon[313]: IKE Packet: receive success. (Responder, Main-Mode message 3). 9/8/13 11:02:51.809 AM racoon[313]: IKE Packet: transmit success. (Responder, Main-Mode message 4). 9/8/13 11:02:51.852 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:02:54.570 AM racoon[313]: IKE Packet: transmit success. (Phase1 Retransmit). 9/8/13 11:02:54.692 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:02:54.854 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:02:57.572 AM racoon[313]: IKE Packet: transmit success. (Phase1 Retransmit). 9/8/13 11:02:57.661 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:02:57.857 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:03:00.575 AM racoon[313]: IKE Packet: transmit success. (Phase1 Retransmit). 9/8/13 11:03:00.645 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:03:00.859 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:03:11.282 AM com.apple.time[373]: Interval maximum value is 946100000 seconds (specified value: 9223372036854775807). 9/8/13 11:03:12.586 AM racoon[313]: IKE Packet: transmit success. (Phase1 Retransmit). 9/8/13 11:03:12.611 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). 9/8/13 11:03:12.861 AM racoon[313]: IKE Packet: receive failed. (Responder, Main-Mode Message 5). iOS shows the following error message: "The L2TP-VPN server did not respond. Try reconnecting. If the problem continues, verify your settings and contact your Administrator." Why am I unable to connect an iPhone to the VPN server while a Mac doesn't have any problems connecting?

  • Answer:

    I finally figured it out: My shared secret was too complex, I configured a new one that's slightly shorter and has no special characters and now iOS is able to establish a VPN connection. It turned out iOS can't handle shared secret of more than 32 characters.

Stan at Ask Different Visit the source

Was this solution helpful to you?

Other answers

You saved me... well, you and replacing the raccoon binary on Maverick with the one from Mountain Lion. Interesting was that I was using the Apple default (generated) shared secret.

krom

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.