目录

Centos系统安装OpenVpn

用最便捷的脚本来满足你的需求

前言: 当在外办公时,有些服务器需要公司内网才可以访问,所以这时候可以设置openVPN连接访问公司内网服务器。 所以可以采用脚本快速搭建访问公司内网,以下推荐两个脚本,都是github使用比较多且正规的脚本,个人推荐第二个脚本,设置选项更多(如连接加密)。

github脚本下载地址1:https://github.com/Nyr/openvpn-install

github脚本下载地址2:https://github.com/angristan/openvpn-install

OpenVpn服务端安装

下载OpenVpn服务端部署脚本

简单方便,一句命令即可安装,根据提示选择即可

#下载
curl -O https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
#添加执行权限
chmod +x openvpn-install.sh
#执行脚本
./openvpn-install.sh

或者直接用git clone,获取整个包,然后进入文件夹执行脚本即可:

#下载
git clone git@github.com:angristan/openvpn-install.git
#执行脚本
bash openvpn-install/openvpn-install.sh

/postsImg/installOpenVpnServer.png

OpenVpn服务端配置和使用

#执行安装命令
bash openvpn-install/openvpn-install.sh

添加用户

/postsImg/openvpnAddUser.png

启动客户端互通

向 /etc/openvpn/server.conf文件尾部增加一行:client-to-client

给客户端指定IP

/etc/openvpn/ccd/[username]

ifconfig-push ${IP} ${NETMASK}
#重启openvpn
systemctl restart openvpn-server@server.service

OpenVpn客户端安装

linux

yum update -y 
yum install epel-release
yum install openvpn
openvpn ***.ovpn 

windwos & mac

OpenVpn客户端配置和使用

OpenVpn服务端配置和使用

OpenVpn服务端卸载

/postsImg/uninstallOpenVpnServer.png