Ubuntu Server上OpenVPN搭建笔记
来源:互联网 发布:av去码软件 编辑:程序博客网 时间:2024/06/05 19:51
参考官方Guide:
https://help.ubuntu.com/lts/serverguide/openvpn.html
大致步骤如下:
- 服务器端
- 安装
openvpn
和easy-rsa
- 构建根证书CA,获得
ca.crt
- 使用构建的CA为服务器创建证书,获得
myservername.crt
、myservername.key
- 创建Diffie Hellman参数,获得
dh2048.pem
- 使用构建的CA为客户端创建证书,获得
client.crt
、client.key
- 使用安全手段将
ca.crt
、client.cr
t、client.key
移动至客户端待用 - 使用
/usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz
作为模板来配置服务器端的server.conf
- 编辑
/etc/sysctl.conf
取消注释#net.ipv4.ip_forward=1
后使用sudo sysctl -p /etc/sysctl.conf
重启sysctl启动IP forwarding - 启动(或重启)openVPN服务:
sudo service openvpn start
或sudo service openvpn restart
ifconfig tun0
检查tun0
- 安装
- 客户端
- 根据平台安装客户端
sudo apt-get install openvpn
- Linux Network-Manager GUI for OpenVPN
- Tunnelblick for Mac
- OpenVPN with GUI for Win 7
- OpenVPN for openWRT
- 使用
/usr/share/doc/openvpn/example/sample-config-files/client.conf
作为模板来配置客户端client.conf
- 使用客户端的配置连接服务器
- 根据平台安装客户端
官方Guide没有的特别注意项:
- 在
server.conf
中启用tls-auth ta.key 0
,在client.conf
中启用tls-auth ta.key 1
,使用openvpn --genkey --secret ta.key
生成ta.key
。 - 如果多人使用用一张客户端证书登陆的话,启用
server.conf
中的duplicate-cn
。 在
server.conf
中配置push路由,让登陆的客户端能够经由服务器的路由访问:push "route 10.8.0.0 255.255.255.0"push "route 192.168.1.0 255.255.255.0"push "route 0.0.0.0 0.0.0.0"
在
server.conf
中启用push "redirect-getway def1 bypass-dhcp"
,客户端将只经由服务器访问网络。- windows客户端的
client.conf
中,需要配置dev-node "控制面板-网络中的本地链接名"
- Ubuntu Server中
ufw allow openvpn
开启防火墙允许openvpnufw default allow routed
开启防火墙允许routed路由ufw status verbose
检查防火墙状态ufw enable
启用防火墙,ufw disable
关闭防火墙
0 0
- Ubuntu Server上OpenVPN搭建笔记
- Ubuntu Server搭建OpenVPN服务器实战
- OpenWrt 搭建OpenVPN Server
- ubuntu 搭建 OPENVPN
- 在Ubuntu 12.04上搭建OpenVPN,无密码登陆
- ubuntu上搭建svn server
- openvpn server 制作(笔记)
- Ubuntu Server下安装OpenVPN Server
- Ubuntu Server 14.04搭建OpenVPN服务器保护你的隐私生活
- 在Ubuntu上搭建git+gitolite server
- 在Ubuntu上搭建Git server
- openvpn access server 一键搭建脚本
- Ubuntu搭建Radius认证的OpenVPN
- ubuntu 16.10下OpenVPN环境搭建过程
- windows上搭建openVPN简明流程
- Ubuntu Server Apache + SVN 的搭建笔记
- 公司内网Debian Server上的openvpn服务器搭建并通过SSH隧道转发到广域网
- 基于Debian/Ubuntu的OpenVPN安装笔记
- 形如:\/Date(1431827575320)\/ 转化为能看懂的时间,形如:2015-6-4 9:56
- 《学习OpenCV》第二章 课后题5
- JQuery淡入淡出效果
- Operational Data Store (ODS) Defined
- JS基础
- Ubuntu Server上OpenVPN搭建笔记
- Servlet和Applet(Java小应用程序)相关知识!!!!------阿冬专栏
- QT messagebox 乱码解决
- WIN7系统下IE9降回IE8的方法
- android中各种颜色在drawable.xml的值
- spring源码gradle获得eclipse工程时,spring-beans-groovy项目GroovyDynamicElementReader报错解决
- shutil模块:复制文件和文件夹,文件压缩
- 基于Unity5.0系统的新打包方式 [第一讲]
- IOS开发之AVAudioPlayer