Community discussions

MikroTik App
 
trunet
newbie
Topic Author
Posts: 28
Joined: Thu Jun 06, 2013 3:55 am

L2TP/IPSec VPN with MacOSX and iOS

Thu Oct 16, 2014 10:37 pm

Hi,

I'm following your http://wiki.mikrotik.com/wiki/Manual:In ... pSec_setup tutorial, however I'm getting stuck on error. I followed exactly steps as showed on that example. Any clues???

I started receiving:
16:25:29 ipsec,error failed to pre-process ph2 packet.
So, I enabled debug and I'm getting this prior to that error:
16:33:07 ipsec,debug,packet 80050001 03000018 05030000 80010001 80020e10 80040002 80050002 00000018 
16:33:07 ipsec,debug,packet 06030000 80010001 80020e10 80040002 80050001 
16:33:07 ipsec,debug,packet begin. 
16:33:07 ipsec,debug,packet seen nptype=2(prop) 
16:33:07 ipsec,debug,packet succeed. 
16:33:07 ipsec,debug,packet proposal #1 len=172 
16:33:07 ipsec,debug,packet begin. 
16:33:07 ipsec,debug,packet seen nptype=3(trns) 
16:33:07 ipsec,debug,packet seen nptype=3(trns) 
16:33:07 ipsec,debug,packet seen nptype=3(trns) 
16:33:07 ipsec,debug,packet seen nptype=3(trns) 
16:33:07 ipsec,debug,packet seen nptype=3(trns) 
16:33:07 ipsec,debug,packet seen nptype=3(trns) 
16:33:07 ipsec,debug,packet succeed. 
16:33:07 ipsec,debug,packet transform #1 len=28 
16:33:07 ipsec,debug,packet type=SA Life Type, flag=0x8000, lorv=seconds 
16:33:07 ipsec,debug,packet type=SA Life Duration, flag=0x8000, lorv=3600 
16:33:07 ipsec,debug,packet life duration was in TLV. 
16:33:07 ipsec,debug,packet type=Encryption Mode, flag=0x8000, lorv=Transport 
16:33:07 ipsec,debug,packet type=Key Length, flag=0x8000, lorv=256 
16:33:07 ipsec,debug,packet type=Authentication Algorithm, flag=0x8000, lorv=hmac-sha1 
16:33:07 ipsec,debug,packet transform #2 len=28 
16:33:07 ipsec,debug,packet type=SA Life Type, flag=0x8000, lorv=seconds 
16:33:07 ipsec,debug,packet type=SA Life Duration, flag=0x8000, lorv=3600 
16:33:07 ipsec,debug,packet life duration was in TLV. 
16:33:07 ipsec,debug,packet type=Encryption Mode, flag=0x8000, lorv=Transport 
16:33:07 ipsec,debug,packet type=Key Length, flag=0x8000, lorv=256 
16:33:07 ipsec,debug,packet type=Authentication Algorithm, flag=0x8000, lorv=hmac-md5 
16:33:07 ipsec,debug,packet transform #3 len=28 
16:33:07 ipsec,debug,packet type=SA Life Type, flag=0x8000, lorv=seconds 
16:33:07 ipsec,debug,packet type=SA Life Duration, flag=0x8000, lorv=3600 
16:33:07 ipsec,debug,packet life duration was in TLV. 
16:33:07 ipsec,debug,packet type=Encryption Mode, flag=0x8000, lorv=Transport 
16:33:07 ipsec,debug,packet type=Key Length, flag=0x8000, lorv=128 
16:33:07 ipsec,debug,packet type=Authentication Algorithm, flag=0x8000, lorv=hmac-sha1 
16:33:07 ipsec,debug,packet transform #4 len=28 
16:33:07 ipsec,debug,packet type=SA Life Type, flag=0x8000, lorv=seconds 
16:33:07 ipsec,debug,packet type=SA Life Duration, flag=0x8000, lorv=3600 
16:33:07 ipsec,debug,packet life duration was in TLV. 
16:33:07 ipsec,debug,packet type=Encryption Mode, flag=0x8000, lorv=Transport 
16:33:07 ipsec,debug,packet type=Key Length, flag=0x8000, lorv=128 
16:33:07 ipsec,debug,packet type=Authentication Algorithm, flag=0x8000, lorv=hmac-md5 
16:33:07 ipsec,debug,packet transform #5 len=24 
16:33:07 ipsec,debug,packet type=SA Life Type, flag=0x8000, lorv=seconds 
16:33:07 ipsec,debug,packet type=SA Life Duration, flag=0x8000, lorv=3600 
16:33:07 ipsec,debug,packet life duration was in TLV. 
16:33:07 ipsec,debug,packet type=Encryption Mode, flag=0x8000, lorv=Transport 
16:33:07 ipsec,debug,packet type=Authentication Algorithm, flag=0x8000, lorv=hmac-sha1 
16:33:07 ipsec,debug,packet transform #6 len=24 
16:33:07 ipsec,debug,packet type=SA Life Type, flag=0x8000, lorv=seconds 
16:33:07 ipsec,debug,packet type=SA Life Duration, flag=0x8000, lorv=3600 
16:33:07 ipsec,debug,packet life duration was in TLV. 
16:33:07 ipsec,debug,packet type=Encryption Mode, flag=0x8000, lorv=Transport 
16:33:07 ipsec,debug,packet type=Authentication Algorithm, flag=0x8000, lorv=hmac-md5 
16:33:07 ipsec,debug,packet pair 1: 
16:33:07 ipsec,debug,packet  0x479ee8: next=(nil) tnext=0x47a670 
16:33:07 ipsec,debug,packet   0x47a670: next=(nil) tnext=0x47a688 
16:33:07 ipsec,debug,packet    0x47a688: next=(nil) tnext=0x47c268 
16:33:07 ipsec,debug,packet     0x47c268: next=(nil) tnext=0x47c280 
16:33:07 ipsec,debug,packet      0x47c280: next=(nil) tnext=0x47c298 
16:33:07 ipsec,debug,packet       0x47c298: next=(nil) tnext=(nil) 
16:33:07 ipsec,debug,packet proposal #1: 6 transform 
16:33:07 ipsec,debug no policy template matching! 
16:33:07 ipsec,error failed to pre-process ph2 packet. 
[admin@trunetroutersp01] > /interface l2tp-server server print 
            enabled: yes
            max-mtu: 1450
            max-mru: 1450
               mrru: disabled
     authentication: pap,chap,mschap1,mschap2
  keepalive-timeout: 30
    default-profile: default-vpn
          use-ipsec: yes
       ipsec-secret: ***MASKED***
[admin@trunetroutersp01] > /ip ipsec peer print 
Flags: X - disabled, D - dynamic 
 0  D address=0.0.0.0/0 local-address=0.0.0.0 passive=yes port=500 auth-method=pre-shared-key secret="***MASKED***" generate-policy=port-strict policy-group=default exchange-mode=main-l2tp send-initial-contact=yes nat-traversal=yes hash-algorithm=sha1 enc-algorithm=3des,aes-128,aes-192,aes-256 dh-group=modp1024 lifetime=1d dpd-interval=2m dpd-maximum-failures=5 
 
trunet
newbie
Topic Author
Posts: 28
Joined: Thu Jun 06, 2013 3:55 am

Re: L2TP/IPSec VPN with MacOSX and iOS

Tue Oct 21, 2014 1:09 am

bump
 
trunet
newbie
Topic Author
Posts: 28
Joined: Thu Jun 06, 2013 3:55 am

Re: L2TP/IPSec VPN with MacOSX and iOS

Tue Oct 21, 2014 10:18 pm

bump
 
TheFatal
just joined
Posts: 8
Joined: Mon Oct 20, 2014 10:33 pm

Re: L2TP/IPSec VPN with MacOSX and iOS

Tue Oct 21, 2014 11:44 pm

Here I've got it working with OSX and Iphone and android and using the following settings:
[admin@****] > /ppp profile print
Flags: * - default 


 1   name="L2TP VPN" bridge=bridge-local use-mpls=default 
     use-compression=default use-vj-compression=default 
     use-encryption=default only-one=default change-tcp-mss=yes 
     address-list="" dns-server=8.8.8.8,8.8.4.4 
[admin@****] > /ppp secret print        
Flags: X - disabled 
 #   NAME        SERVICE CALLER-ID     PASSWORD     PROFILE     REMOTE-ADDRESS 
 0   Test ... l2tp                  Password  L2TP VPN    192.168.88.40 
[admin@*****] > /ip ipsec policy print
Flags: T - template, X - disabled, D - dynamic, I - inactive, * - default 
 0 T * group=default src-address=0.0.0.0/0 dst-address=0.0.0.0/0 protocol=all 
       proposal=default template=yes 
[admin@****] > /ip ipsec peer  print  
Flags: X - disabled, D - dynamic 
 0    address=0.0.0.0/0 local-address=0.0.0.0 passive=no port=500 
      auth-method=pre-shared-key secret="*******" 
      generate-policy=port-override exchange-mode=main-l2tp 
      send-initial-contact=yes nat-traversal=yes hash-algorithm=sha1 
      enc-algorithm=3des dh-group=modp1024 lifetime=1d dpd-interval=2m 
      dpd-maximum-failures=5 
[admin@****] > /ip firewall filter print
Flags: X - disabled, I - invalid, D - dynamic 


 5    ;;; VPN
      chain=input action=accept protocol=udp in-interface=Gateway-ETH10 
      dst-port=500 log=no log-prefix="" 

 6    chain=input action=accept protocol=udp in-interface=Gateway-ETH10 
      dst-port=1701 log=no log-prefix="" 

 7    chain=input action=accept protocol=udp in-interface=Gateway-ETH10 
      dst-port=4500 log=no log-prefix="" 

 8    chain=input action=accept protocol=ipsec-esp in-interface=Gateway-ETH10 
      log=no log-prefix=""
Hope this helps!
 
trunet
newbie
Topic Author
Posts: 28
Joined: Thu Jun 06, 2013 3:55 am

Re: L2TP/IPSec VPN with MacOSX and iOS

Wed Oct 22, 2014 7:48 pm

are you using ROS 6.20?
 
TheFatal
just joined
Posts: 8
Joined: Mon Oct 20, 2014 10:33 pm

Re: L2TP/IPSec VPN with MacOSX and iOS

Wed Oct 22, 2014 8:34 pm

ROS 6.19
 
trunet
newbie
Topic Author
Posts: 28
Joined: Thu Jun 06, 2013 3:55 am

Re: L2TP/IPSec VPN with MacOSX and iOS

Wed Oct 22, 2014 8:52 pm

worked perfectly, thank you very much.

However I think ROS has a bug on l2tp server use-ipsec=yes to auto-generate ipsec policy. It doesn't work with any of the devices I have.
 
TheFatal
just joined
Posts: 8
Joined: Mon Oct 20, 2014 10:33 pm

Re: L2TP/IPSec VPN with MacOSX and iOS

Wed Oct 22, 2014 11:34 pm

no problem!
 
miguelcandia
just joined
Posts: 1
Joined: Wed Jun 12, 2013 7:49 pm

Re: L2TP/IPSec VPN with MacOSX and iOS

Wed Dec 17, 2014 8:28 am

Hi,

Have you tested on ROS 6.22?
MikroTik LAN IP is 172.16.48.254.
I have the following:
MKTK> ppp profile print
Flags: * - default
 1   name="VPN" local-address=172.16.48.254 remote-address=VPN use-mpls=default 
     use-compression=default use-vj-compression=default use-encryption=default 
     only-one=no change-tcp-mss=default address-list="" dns-server=172.16.48.14
Where VPN is an IP pool:
MKTK> ip pool print 
 # NAME                                           RANGES                         
 0 VPN                                            172.16.53.200-172.16.53.222 
And ppp secret:
MKTK> ppp secret print
Flags: X - disabled 
 #   NAME       SERVICE CALLER-ID      PASSWORD      PROFILE      REMOTE-ADDRESS 
 0   user           l2tp                                password          VPN         
Policy config:
MKTK> ip ipsec policy print
Flags: T - template, X - disabled, D - dynamic, I - inactive, * - default 
 0 T * group=default src-address=0.0.0.0/0 dst-address=0.0.0.0/0 protocol=all proposal=default template=yes
Peer config:
MKTK> ip ipsec peer print
Flags: X - disabled, D - dynamic
 1    address=0.0.0.0/0 local-address=0.0.0.0 passive=no port=500 
      auth-method=pre-shared-key secret="Secret" 
      generate-policy=port-override policy-template-group=default 
      exchange-mode=main-l2tp send-initial-contact=no nat-traversal=yes 
      hash-algorithm=sha1 enc-algorithm=3des,aes-256 dh-group=modp1024 
      lifetime=1h dpd-interval=2m dpd-maximum-failures=5 
Only difference I see is the bridge, but I'm not sure what could be wrong. Firewall has all the rules you posted. If you can help me I'd be really grateful!
 
Norman29
just joined
Posts: 10
Joined: Sat Feb 08, 2014 9:08 pm

Re: L2TP/IPSec VPN with MacOSX and iOS

Sun Oct 23, 2016 8:20 pm

Here I've got it working with OSX and Iphone and android and using the following settings:

(...)
Hope this helps!
Thanks! a 2 year old post but i got my iPhone 7 working on VPN now :D
 
User avatar
enggheisar
Trainer
Trainer
Posts: 20
Joined: Sun Mar 29, 2015 10:12 am
Location: Austin, TX
Contact:

Re: L2TP/IPSec VPN with MacOSX and iOS

Sat Oct 29, 2016 7:36 am

I have gor problem with mikrotik ip sec for Apple ios
the log :
Failed to get valid proposal
Failed to pre process ph1 packet(side :1,status : 1)
phase1 negotioation failed

what shall i do ?

Who is online

Users browsing this forum: Gomo, infabo, Ralfu, voljka and 79 guests