安装openvpn , 之前按网上教程都是采用yum install openvpn,再手工生成密钥和证书,整个过程比较复杂,如在ubuntu 上安装方式还不太一样。
后来发现有个简单脚本可以快速1分钟完成安装。
以下记录了些安装过程,以做备忘
https://linuxtechlab.com/simple-guide-install-openvpn-centos-ubuntu/
https://github.com/Nyr/openvpn-install
cd /usr/local/src
wget https://git.io/vpn -O openvpn.sh
chmod +x openvpn.sh
./openvpn.sh
writing new private key to '/etc/openvpn/easy-rsa/pki/private/server.key.YXhKrZVpMK'
writing new private key to '/etc/openvpn/easy-rsa/pki/private/client.key.WEmR2CRmme'
CRL file: /etc/openvpn/easy-rsa/pki/crl.pem
/etc/openvpn/easy-rsa/pki/issued/client.crt
/etc/openvpn/easy-rsa/pki/private/client.key
/root/client.ovpn
配置文件修改:
/etc/openvpn/server.conf
添加以下内容
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
log openvpn.log
启动:
nohup /usr/sbin/openvpn --cd /etc/openvpn/ --config server.conf &
日志:
tail -f /etc/openvpn/openvpn.log
查看端口是否开启
netstat -anlu
nc -vuz xxx.xxx.xxx.xxx 1194
网友评论