阿里云轻量应用服务器安装IPsec VPN

记录于2021-02-21,OS为阿里云轻量应用服务器CentOS 7.3

项目地址:https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/README-zh.md
Libreswan 作为 IPsec 服务器,以及 xl2tpd 作为 L2TP 提供者

搭建

yum -y update 并重启

wget https://git.io/vpnsetup-centos -O vpn.sh && sudo sh vpn.sh执行完毕会出现如下内容,记住IPsec PSK Username Password后面要用到

IPsec VPN server is now ready for use!
Connect to your new VPN with these details:
Server IP: 我是Server IP
IPsec PSK: 我是IPsec PSK
Username: 我是Username
Password: 我是Password
Write these down. You'll need them to connect!
Important notes:   https://git.io/vpnnotes
Setup VPN clients: https://git.io/vpnclients

至此vpn搭建完成。

管理服务

ipsecxl2tpd使用systemctl

[root@izbp112i9bshiu2ybihp3mz admin]# systemctl | egrep 'xl2tpd|ipsec'
  ipsec.service                                                               loaded active running   Internet Key Exchange (IKE) Protocol Daemon for IPsec
  xl2tpd.service                                                              loaded active running   Level 2 Tunnel Protocol Daemon (L2TP)
[root@izbp112i9bshiu2ybihp3mz admin]#

日志

grep pluto /var/log/secure
grep xl2tpd /var/log/messages

服务器控制台防火墙

打开UDP端口500和4500(github的文档中没有提,这是真的坑)

操作系统内防火墙

iptables.service使用firewalld.service都是关闭状态,如果开启,应该也需要开启500和4500端口。

客户端连接

https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients-zh.md#windows
只尝试过win7系统,严格按照文档中的操作来:先运行两个注册表文件,再配置连接就可以了。

你可能感兴趣的:(阿里云轻量应用服务器安装IPsec VPN)