使用 strongswan 配置 vpn

使用 strongswan 配置 vpn

我需要做一个站点到站点的 vpn,要集成的公司给了我这些参数。

网关:41.xxx.xx.xx

主机 IP :41.xxx.x.xx 端口 xxxx

变换集:esp-aes-256 esp-md5-hmac

预共享密钥:xxxxxxxxxxxxxxxxxxxx

我已经配置了 Strongswanhttp://www.strongswan.org. 但不幸的是我无法让它工作。

有人做过这个吗?谢谢。

已编辑..............................................这是我的 auth.log

 May 11 21:23:52 li348-231 sshd[3000]: Connection closed by 58.108.232.7 [preauth]
May 11 21:24:05 li348-231 sshd[3012]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=60.173.14.143  user=root
May 11 21:24:07 li348-231 sshd[3012]: Failed password for root from 60.173.14.143 port 39095 ssh2
May 11 21:24:10 li348-231 sshd[3012]: Received disconnect from 60.173.14.143: 11: Normal Shutdown, Thank you for playing [preauth]
May 11 21:24:13 li348-231 sshd[3015]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=60.173.14.143  user=root
May 11 21:24:15 li348-231 sshd[3015]: Failed password for root from 60.173.14.143 port 41129 ssh2
May 11 21:24:15 li348-231 sshd[3015]: Received disconnect from 60.173.14.143: 11: Normal Shutdown, Thank you for playing [preauth]
May 11 21:25:01 li348-231 CRON[3018]: pam_unix(cron:session): session opened for user root by (uid=0)
May 11 21:25:01 li348-231 CRON[3018]: pam_unix(cron:session): session closed for user root
May 11 21:26:21 li348-231 ipsec_starter[3021]: Starting strongSwan 5.1.2 IPsec [starter]...
May 11 21:26:21 li348-231 ipsec_starter[3040]: charon (3041) started after 20 ms
May 11 21:29:47 li348-231 ipsec_starter[3040]: charon stopped after 200 ms
May 11 21:29:47 li348-231 ipsec_starter[3040]: ipsec starter stopped
May 11 21:29:50 li348-231 ipsec_starter[3204]: Starting strongSwan 5.1.2 IPsec [starter]...
May 11 21:29:50 li348-231 ipsec_starter[3225]: charon (3226) started after 20 ms
May 11 21:35:01 li348-231 CRON[3310]: pam_unix(cron:session): session opened for user root by (uid=0)
May 11 21:35:01 li348-231 CRON[3310]: pam_unix(cron:session): session closed for user root

编辑以添加 tail -f /var/log/syslog 输出

May 12 09:02:06 li348-231 charon: 00[CFG] loading attribute certificates from '/etc/ipsec.d/acerts'
May 12 09:02:06 li348-231 charon: 00[CFG] loading crls from '/etc/ipsec.d/crls'
May 12 09:02:06 li348-231 charon: 00[CFG] loading secrets from '/etc/ipsec.secrets'
May 12 09:02:06 li348-231 charon: 00[CFG]   loaded IKE secret for @blinks.com @ccxtnm.net 
May 12 09:02:06 li348-231 charon: 00[LIB] loaded plugins: charon test-vectors aes rc2 sha1 sha2 md4 md5 rdrand random nonce x509 revocation constraints pkcs1 pkcs7 pkcs8 pkcs12 pem openssl xcbc cmac hmac ctr ccm gcm attr kernel-netlink resolve socket-default stroke updown eap-identity eap-mschapv2 addrblock
May 12 09:02:06 li348-231 charon: 00[LIB] unable to load 5 plugin features (5 due to unmet dependencies)
May 12 09:02:06 li348-231 charon: 00[LIB] dropped capabilities, running as uid 0, gid 0
May 12 09:02:06 li348-231 charon: 00[JOB] spawning 16 worker threads
May 12 09:02:06 li348-231 charon: 10[CFG] received stroke: add connection 'net-net'
May 12 09:02:06 li348-231 charon: 10[CFG] added configuration 'net-net'

答案1

您应该提供 StrongSwan 服务器生成的日志,以便人们能够帮助您。以下是查找与您的问题相关的日志的方法:

  1. 使用以下方式启动 VPN 服务器:

    sudo ipsec start
    
  2. VPN 服务器运行后,在终端中输入以下命令,查看机器上发生的情况:

    sudo tail -f /var/log/syslog
    

    此命令可让您在终端上看到正在记录到系统日志中的事件。

  3. 现在尝试从 VPN 客户端连接。如果客户端可以访问服务器,您将看到正在处理syslog下记录的事件charon。如果您看不到与 相关的任何内容charon,则很可能是网络连接问题。

  4. 您还可以sudo tail -x /var/log/syslog > debugfile转储x系统日志的最后几行,以便debugfile更好地进行分析

  5. 如果您无法识别问题,请在此处发布这些日志。

相关内容