目录
Windows用户: 访问StrongSwan官网。 下载并安装最新版本的 installer。 运行安装程序,按照提示完成安装。 重启系统后,确保Windows防火墙允许StrongSwan通过。 Linux用户: 使用包管理器安装:sudo apt-get install strongswan 或者从源码编译安装。 生成证书 生成证书需要使用strongswan-certs工具。 服务器证书:sudo ipsec-certs --generate-server-certificate serverCert.pem 客户端证书:sudo ipsec-certs --generate-user-certificate userCert.pem 导出私钥:sudo ipsec-certs --export-private-key serverPrivateKey.pem sudo ipsec-certs --export-private-key userPrivateKey.pem 配置服务器(strongswan.conf) 默认配置文件位于/etc/strongswan/strongswan.conf,建议备份后编辑。 添加 IKEv2 配置: version 2. ike: local=192.168.1.1@PSK ike: 192.168.1.2@PSK ike: 192.168.1.3@PSK ike: 192.168.1.4@PSK ike: 2001:db8:1::ab:cd:ef:01@PSK ike: 2001:db8:2::1:ab:cd:ef:01@PSK ike: 2001:db8:3::1:ab:cd:ef:01@PSK ike: 2001:db8:4::1:ab:cd:ef:01@PSK ike: local=ME@PSK ike: remote=YOU@PSK ike: local=192.168.2.1@PSK ike: remote=192.168.2.2@PSK ike: local=192.168.3.1@PSK ike: remote=192.168.3.2@PSK ike: lo...
  • Windows用户

    • 访问StrongSwan官网
    • 下载并安装最新版本的 installer。
    • 运行安装程序,按照提示完成安装。
    • 重启系统后,确保Windows防火墙允许StrongSwan通过。
  • Linux用户

    • 使用包管理器安装:
      sudo apt-get install strongswan
    • 或者从源码编译安装。

生成证书

生成证书需要使用strongswan-certs工具。

  • 服务器证书
    sudo ipsec-certs --generate-server-certificate serverCert.pem
  • 客户端证书
    sudo ipsec-certs --generate-user-certificate userCert.pem
  • 导出私钥
    sudo ipsec-certs --export-private-key serverPrivateKey.pem
    sudo ipsec-certs --export-private-key userPrivateKey.pem

配置服务器(strongswan.conf

默认配置文件位于/etc/strongswan/strongswan.conf,建议备份后编辑。

  • 添加 IKEv2 配置
    version 2.
    ike: local=192.168.1.1@PSK
    ike: 192.168.1.2@PSK
    ike: 192.168.1.3@PSK
    ike: 192.168.1.4@PSK
    ike: 2001:db8:1::ab:cd:ef:01@PSK
    ike: 2001:db8:2::1:ab:cd:ef:01@PSK
    ike: 2001:db8:3::1:ab:cd:ef:01@PSK
    ike: 2001:db8:4::1:ab:cd:ef:01@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=2001:db8::1@PSK
    ike: remote=2001:db8::2@PSK
    ike: local=2001:db8::3@PSK
    ike: remote=2001:db8::4@PSK
    ike: local=ME@PSK
    ike: remote=YOU@PSK
    ike: local=192.168.2.1@PSK
    ike: remote=192.168.2.2@PSK
    ike: local=192.168.3.1@PSK
    ike: remote=192.168.3.2@PSK
    ike: local=

1.安装StrongSwan

扫描二维码推送至手机访问。

本文转载自互联网,如有侵权,联系删除。

本文链接:https://xiaofeijivpn.com.cn/post/3648.html

扫描二维码手机访问

文章目录
网站地图