OpenVPN TCP,static key,支持客户端behind NAT的简单配置文件。
在服务器和客户端上都安装OpenVPN:
1 |
apt install openvpn |
生成static key:
1 |
openvpn --genkey --secret static.key |
服务器配置/etc/openvpn/server/tun0.conf
:
1 2 3 4 5 6 7 8 9 |
dev tun ifconfig 10.9.8.1 10.9.8.2 secret static.key proto tcp-server comp-lzo keepalive 10 60 ping-timer-rem persist-tun persist-key |
static key复制到/etc/openvpn/server/static.key
。
启动服务端:
1 |
systemctl start openvpn-server@tun0 |
客户端配置/etc/openvpn/client/tun0.conf
:
1 2 3 4 5 6 7 8 9 10 |
remote your.openvpn.server.example.com dev tun ifconfig 10.9.8.2 10.9.8.1 secret static.key proto tcp-client comp-lzo keepalive 10 60 ping-timer-rem persist-tun persist-key |
static key复制到/etc/openvpn/client/static.key
。
启动客户端:
1 |
systemctl start openvpn-client@tun0 |