ikev2的vpn是苹果系统默认推荐的方式,不需要下载客户端,企业用户配合ldap账号管理很方便。
以下方法基于ubuntu16.04系统,使用脚本https://quericy.me/blog/699/

20180823提醒一下,strongswan不支持野卡(通配符域名证书),需要使用具体的域名证书。
参考https://tools.ietf.org/html/rfc6125#section-7.2

20180524添加我改写的一键安装脚本https://github.com/trepwq/ikev2-radius-ldap/raw/master/install-ikev2-radius-ldap.sh
以下为原作者脚本安装步骤

首先申请域名证书,可以用阿里云免费的单域名证书,申请下来后证书里第一部分是域名证书,写入server.cert.pem;第二部分是ca证书,写入ca.cert.pem ,另一个key文件修改为server.pem,把这三个文件放到quericy脚本的相同目录里。
然后按照提示一步一步来,需要注意的是我开启了snat,其他为默认。如果网卡ip地址是内网ip,就输入内网ip,然后在路由器端把500和4500端口的udp转发给这个内网ip就可以了。
脚本安装完之后修改配置文件/usr/local/etc/ipsec.conf, 把里面的rightauth=eap-mschapv2修改为rightauth=eap-radius,然后在/usr/local/etc/strongswan.d/charon/eap-radius.conf 的servers段添加服务器地址和密码

servers {
        server_synology {
                        address = 192.168.1.1
                        secret = secret
                        }
}

我这里使用了群晖的radius-server。
最后重启ipsec restart。ps,ipsec reload对很多修改不起作用。
最最后添加ipsec开机启动

root@ubuntu:~# cat /etc/rc.local 
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/usr/local/sbin/ipsec start


exit 0

由于使用了域名证书,根证书在苹果系统里是已经存在的,所以不需要导入证书,直接输入用户名密码即可。