我正在尝试在 Ubuntu 计算机上使用 Openswan(版本 5.6.2)启动 VPN。
但是当我启动以下命令时,它显示“缺少配置名称”:
sudo swanctl --initiate vpn-name
initiate failed: missing configuration name
这是 IPSEC Statusall 命令的输出:
sudo ipsec statusall
Status of IKE charon daemon (strongSwan 5.6.2, Linux 5.3.0-1032-aws, x86_64):
uptime: 11 hours, since Aug 07 14:43:36 2020
malloc: sbrk 2568192, mmap 0, used 550784, free 2017408
worker threads: 11 of 16 idle, 5/0/0/0 working, job queue: 0/0/0/0, scheduled: 0
loaded plugins: charon aesni aes rc2 sha2 sha1 md4 md5 mgf1 random nonce x509 revocation constraints
pubkey pkcs1 pkcs7 pkcs8 pkcs12 pgp dnskey sshkey pem openssl fips-prf gmp agent xcbc hmac gcm attr kernel-netlink resolve socket-default connmark stroke vici updown eap-mschapv2 xauth-generic counters
Listening IP addresses:
172.X.Y.Z
172.X.0.X
Connections:
Security Associations (0 up, 0 connecting):
none
以下是配置/etc/ipsec.conf
cat /etc/ipsec.conf
# ipsec.conf - strongSwan IPsec configuration file
# basic configuration
config setup
strictcrlpolicy=no
uniqueids = yes
charondebug="all"
#nat_traversal=yes
# strictcrlpolicy=yes
# uniqueids = no
# Add connections here.
# Sample VPN connections
conn vpn-name
type=tunnel
keyexchange=ikev2
authby=secret
#leftid=172.x.x.x
#Left is me
left=3.x.x.x
leftsubnet=172.32.X.X
#leftsubnet=10.1.4.0/16
#right is MTN CIV
right=19.X.X.X
rightsubnet=10.18.X.0/24
ike=3des-sha1,aes256-sha1,aes128-sha1!
esp=3des-sha1,aes256-sha1
auto=route
lifetime=8h
dpddelay=30
dpdtimeout=120
dpdaction=restart
auto=start
答案1
swanctl 是一个新的、可移植的命令行实用程序,用于使用 vici 界面配置、控制和监视 IKE 守护进程 Charon。它是在 StrongSwan 5.2.0 中引入的。
swanctl 独立于 starter、ipsec.conf 或 ipsec 脚本工作,是所有平台上可用的轻量级替代方案。
swanctl
配置完成后即可使用/etc/swanctl/swanctl.conf
。
如果您配置了旧版本ipsec.conf
,则需要使用以下命令启动连接:
sudo ipsec up vpn-name