尝试编译2.6.11(失败)
- 从官网下载源码
https://github.com/OpenVPN/openvpn/releases/download/v2.6.11/openvpn-2.6.11.tar.gz - 解压
tar zxvf openvpn-2.6.11.tar.gz cd openvpn-2.6.11autoreconf -i -v -f./configure- 出现报错,要求libnl版本在3.4以上,但镜像源中的libnl最高版本只有3.2
- 下载3.4版本rpm包
wget https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/getPackage/libnl3-3.4.0-4.el8.x86_64.rpm - 安装
rpm -ivh libnl3-3.4.0-4.el8.x86_64.rpm - 发现文件冲突,卸载旧版后再次安装
rpm -e --nodeps libnl3-3.2.28-4.el7.x86_64
rpm -ivh libnl3-3.4.0-4.el8.x86_64.rpm
- 查询包配置路径
pkg-config --variable pc_path pkg-config - 找到配置文件
libnl-3.0.pc和libnl-genl-3.0.pc用vim打开版本号修改为3.4 - 再次运行
./configure报错libcap-ng package not found yum install libcap-ng-devel- 再次运行
./configure报错No compatible LZ4 compression library found yum install lz4-devel lz4./configure- make报错,因为有未定义的宏,和dco有关,推测可能是因为centos7支持的libnl最高版本只有3.2.28,虽然下载了3.4.0但是系统不支持,放弃
编译2.5.10
- 把之前装的libnl卸掉重装,让版本退回去
yum remove libnl3
yum install libnl3
yum install libnl3-devel
- 验证版本
pkg-config --modversion libnl-genl-3.0 - 拉2.5.10源码解压缩,配置
wget https://github.com/OpenVPN/openvpn/releases/download/v2.5.10/openvpn-2.5.10.tar.gz
tar zxvf openvpn-2.5.10.tar.gz
cd openvpn-2.5.10
./configure
make && make install- 验证版本
openvpn --version cd ~/mkdir ovpn-server-config- 环境配置看这篇文章,因为我已经配过了,就不赘述了。
- 生成证书和密钥
cd ovpn-server-config
/usr/share/easy-rsa/3.0.8/easyrsa init-pki
/usr/share/easy-rsa/3.0.8/easyrsa gen-req server nopass
/usr/share/easy-rsa/3.0.8/easyrsa sign server server
/usr/share/easy-rsa/3.0.8/easyrsa gen-dh
/usr/share/easy-rsa/3.0.8/easyrsa gen-req client nopass
/usr/share/easy-rsa/3.0.8/easyrsa sign client client
vim server.conf之后写入服务端配置,不加赘述- 运行客户端,尝试连接,成功。
遗留问题
- 2.5.10依然不支持tls1.3版本,新特性用不上
- udp方式连接校验有问题,尚未解决