ipsec配置strongswan.conf和ipsec.conf

时间:2022-01-21 10:36:50

配置strongswan.conf

vi /usr/local/etc/strongswan.conf

# strongswan.conf - strongSwan configuration file
#
# Refer to the strongswan.conf(5) manpage for details
#
# Configuration changes should be made in the included files charon {
load_modular = yes
duplicheck.enable = no
compress = yes
plugins {
include strongswan.d/charon/*.conf
}
dns1 = 8.8.8.8
dns2 = 8.8.4.4
nbns1 = 8.8.8.8
nbns2 = 8.8.4.4
}
include strongswan.d/*.conf

配置ipsec.conf

vi /usr/local/etc/ipsec.conf

config setup
uniqueids=never conn android_xauth_psk
keyexchange=ikev1
left=%defaultroute
leftauth=psk
leftsubnet=0.0.0.0/0
right=%any
rightauth=psk
rightauth2=xauth
rightsourceip=10.31.2.0/24
auto=add

配置ipsec.secrets

vi /usr/local/etc/ipsec.secrets
RSA server.pem
PSK "key"
XAUTH "key"

user %any : EAP "password"