18.04 L2TP VPN 配置 - 我遗漏了什么?

18.04 L2TP VPN 配置 - 我遗漏了什么?

我一直在尝试使用 Ubuntu 笔记本电脑连接到我们的 L2TP VPN 服务器,我尝试使用 18.04 和 19.04,并遵循了几个教程,这些教程基本上就是安装network-manager-l2tpnetwork-manager-l2tp-gnome。我已经到了这一步:

May 17 12:34:14 lap-linux-001 NetworkManager[583]: <info>  [1558110854.8704] audit: op="connection-activate" uuid="2dba1ee5-c86e-46e9-b0e4-5ce89738d380" name="ADS" pid=1509 uid=1000 result="success"
May 17 12:34:14 lap-linux-001 NetworkManager[583]: <info>  [1558110854.8758] vpn-connection[0x5603ef4be7a0,2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS",0]: Started the VPN service, PID 8635
May 17 12:34:14 lap-linux-001 NetworkManager[583]: <info>  [1558110854.8878] vpn-connection[0x5603ef4be7a0,2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS",0]: Saw the service appear; activating connection
May 17 12:34:18 lap-linux-001 systemd[1]: NetworkManager-dispatcher.service: Succeeded.
May 17 12:34:19 lap-linux-001 NetworkManager[583]: <info>  [1558110859.3039] settings-connection[0x5603ef3ae480,2dba1ee5-c86e-46e9-b0e4-5ce89738d380]: write: successfully updated (keyfile: update /etc/NetworkManager/system-connections/ADS.nmconnection (2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS")), connection was modified in the process
May 17 12:34:19 lap-linux-001 NetworkManager[583]: <info>  [1558110859.3085] vpn-connection[0x5603ef4be7a0,2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS",0]: VPN connection: (ConnectInteractive) reply received
May 17 12:34:19 lap-linux-001 nm-l2tp-service[8635]: Check port 1701
May 17 12:34:19 lap-linux-001 nm-l2tp-service[8635]: Can't bind to port 1701
May 17 12:34:19 lap-linux-001 NetworkManager[583]: Stopping strongSwan IPsec failed: starter is not running
May 17 12:34:21 lap-linux-001 NetworkManager[583]: Starting strongSwan 5.7.1 IPsec [starter]...
May 17 12:34:21 lap-linux-001 NetworkManager[583]: Loading config setup
May 17 12:34:21 lap-linux-001 NetworkManager[583]: Loading conn '2dba1ee5-c86e-46e9-b0e4-5ce89738d380'
May 17 12:34:21 lap-linux-001 NetworkManager[583]: found netkey IPsec stack
May 17 12:34:21 lap-linux-001 charon: 00[DMN] Starting IKE charon daemon (strongSwan 5.7.1, Linux 5.0.0-13-generic, x86_64)
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading ca certificates from '/etc/ipsec.d/cacerts'
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading aa certificates from '/etc/ipsec.d/aacerts'
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading ocsp signer certificates from '/etc/ipsec.d/ocspcerts'
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading attribute certificates from '/etc/ipsec.d/acerts'
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading crls from '/etc/ipsec.d/crls'
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading secrets from '/etc/ipsec.secrets'
May 17 12:34:21 lap-linux-001 charon: 00[CFG] loading secrets from '/etc/ipsec.d/nm-l2tp-ipsec-2dba1ee5-c86e-46e9-b0e4-5ce89738d380.secrets'
May 17 12:34:21 lap-linux-001 charon: 00[CFG]   loaded IKE secret for %any
May 17 12:34:21 lap-linux-001 charon: 00[LIB] 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 updown eap-mschapv2 xauth-generic counters
May 17 12:34:21 lap-linux-001 charon: 00[LIB] dropped capabilities, running as uid 0, gid 0
May 17 12:34:21 lap-linux-001 charon: 00[JOB] spawning 16 worker threads
May 17 12:34:21 lap-linux-001 charon: 06[CFG] received stroke: add connection '2dba1ee5-c86e-46e9-b0e4-5ce89738d380'
May 17 12:34:21 lap-linux-001 charon: 06[CFG] algorithm 'ecp_384' not recognized
May 17 12:34:21 lap-linux-001 charon: 06[CFG] skipped invalid proposal string: aes256-sha1-ecp_384
May 17 12:34:22 lap-linux-001 charon: 08[CFG] rereading secrets
May 17 12:34:22 lap-linux-001 charon: 08[CFG] loading secrets from '/etc/ipsec.secrets'
May 17 12:34:22 lap-linux-001 charon: 08[CFG] loading secrets from '/etc/ipsec.d/nm-l2tp-ipsec-2dba1ee5-c86e-46e9-b0e4-5ce89738d380.secrets'
May 17 12:34:22 lap-linux-001 charon: 08[CFG]   loaded IKE secret for %any
May 17 12:34:22 lap-linux-001 charon: 09[CFG] received stroke: initiate '2dba1ee5-c86e-46e9-b0e4-5ce89738d380'
May 17 12:34:22 lap-linux-001 charon: 09[CFG] no config named '2dba1ee5-c86e-46e9-b0e4-5ce89738d380'
May 17 12:34:22 lap-linux-001 NetworkManager[583]: no config named '2dba1ee5-c86e-46e9-b0e4-5ce89738d380'
May 17 12:34:22 lap-linux-001 NetworkManager[583]: Stopping strongSwan IPsec...
May 17 12:34:22 lap-linux-001 charon: 00[DMN] signal of type SIGINT received. Shutting down
May 17 12:34:22 lap-linux-001 nm-l2tp-service[8635]: g_dbus_method_invocation_take_error: assertion 'error != NULL' failed
May 17 12:34:22 lap-linux-001 NetworkManager[583]: <info>  [1558110862.8278] vpn-connection[0x5603ef4be7a0,2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS",0]: VPN plugin: state changed: stopped (6)
May 17 12:34:22 lap-linux-001 NetworkManager[583]: <info>  [1558110862.8313] vpn-connection[0x5603ef4be7a0,2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS",0]: VPN service disappeared
May 17 12:34:22 lap-linux-001 NetworkManager[583]: <warn>  [1558110862.8326] vpn-connection[0x5603ef4be7a0,2dba1ee5-c86e-46e9-b0e4-5ce89738d380,"ADS",0]: VPN connection: failed to connect: 'Message recipient disconnected from message bus without replying'

我还能够在 Fedora 中建立连接,因此我很确定我使用的是正确的配置选项,但我甚至没有看到在 Ubuntu 端禁用 PFS 的选项。

从我读到的内容来看,它似乎正在寻找一个不存在的配置?但我不确定它想让我把它放在哪里/创建/添加在哪里。也许是 ipsec.conf?但这个字符串看起来不像我见过的任何其他例子。

我对 Linux 不太熟悉,但这是我第一次使用 VPN。感谢您阅读本文,任何帮助都将不胜感激。

答案1

我可以给你提供使我的 ipsec vpn 正常运行所需的步骤(在 18.04 上)。

sudo apt install strongswan

然后安装 libcharon-extra-plugins 和 libstrongswan-extra-plugins。我使用 synaptic 包管理器执行此操作。我需要这些模块 eap-identity。根据 vpn 设置创建正确的 /etc/ipsec.conf。创建或修改 ipsec.secrets

我需要一些额外的步骤,但这可能依赖于 vpn:

  • 在 /etc/strongswan.d/charon/constraints.conf 中,将“load = yes”更改为“load = no”

  • 更改证书

      sudo rmdir /etc/ipsec.d/cacerts  (maybe make a backup first)
      sudo ln -s /etc/ssl/certs /etc/ipsec.d/cacerts
    
  • 就我个人而言,我需要在 vpn 期间进行 dns 操作

      sudo apt install resolvconf
      sudo dpkg-reconfigure resolvconf
      reboot
    

最后 :

    sudo ipsec restart
    sudo ipsec up <vpn-name>

希望这对你有所帮助。

相关内容