赞
踩
https://github.com/matfabia/strongswan
ipsec.conf官网配置示例
官网https://wiki.strongswan.org/projects/strongswan/wiki/ConnSection
# ipsec.conf - strongSwan IPsec configuration file # basic configuration config setup # strictcrlpolicy=yes # uniqueids = no # Add connections here. # Sample VPN connections #conn sample-self-signed //ipsec隧道名 一条ipsec配置的起始处 # leftsubnet=10.1.0.0/16 # leftcert=selfCert.der # leftsendcert=never # right=192.168.0.2 # rightsubnet=10.2.0.0/16 # rightcert=peerCert.der # auto=start #conn sample-with-ca-cert # leftsubnet=10.1.0.0/16 # leftcert=myCert.pem # right=192.168.0.2 # rightsubnet=10.2.0.0/16 # rightid="C=CH, O=Linux strongSwan CN=peer name" # auto=start
服务端-实例配置
只配置了必要的参数
config setup charondebug="cfg 4, dmn 4, ike 4, net 4, knl 4" uniqueids=yes strictcrlpolicy=no conn %default ikelifetime=24h //在重新协商之前应该持续多长时间 keylife=8h //从成功协商到期应该持续多长时间 rekeymargin=30m keyingtries=3 keyexchange=ikev2 authby=psk dpddelay=180s ike=aes256-sha1-modp2048! esp=aes192-sha1-esn! //用于连接ESP加密认证算法 mobike=no conn test //隧道名称,一条ipsec的起始处 left=%any //ipsec协商公网IP 填写IP或者%defaultroute leftcert=vrf_0.pem //公钥证书 leftsubnet=192.168.0.1/32 //本段保护子网 leftid=198.18.0.1 //本端id leftfirewall=yes //关闭防火 right=%any //ipsec对端IP %any表示任意,服务端配置为%any rightid=198.18.0.2 //对端id rightsubnet=0.0.0.0/0 //对端保护子网 rightdns=114.114.114.114 auto=add //不发起ipsec连接
客户端-实例配置
conn %default ... type=tunnel dpddelay=180s apdaction=restart //dpd检测失败后重新连接 conn test-cli left=192.168.100.180 auto=start //主动发起连接 keyingtries=%forever //直到协商成功 letfsubnet=192.18.0.2 //保护子网 right=192.168.100.161 //服务端IP leftid=198.18.0.2 //移动端ios作为标识要用 reghtid=198.18.0.1 //对端
ipsec.secrets配置
配置psk密钥
:PSK “vpp123” //默认psk
rightid :PSK “123456” //psk绑定隧道
配置私钥证书
:RSA 1-key.pem //存放于 /usr/local/etc/ipsec.d/peivate/ 目录下
配置EAP用户名和密码
:test :EAP "123456" //用户名test 密码123456
:EAP “vpp123” //用户名任意,密码vpp123
ipsec.secrets配置文件
strongswan.conf配置文件
ron {
load_modular = yes
plugins {
include strongswan.d/charon/*.conf //加载插件
}
filelog {
/var/log/strongswan-log {
time_format-log = %b %e %T
default = 1 //日志调试级别
append = no
flush_line = yes
}
}
}
include strongswan.d/*.conf //加载其下的所有.conf文件
所有.conf文件
所有插件
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。