1、如何在Windows環境下安裝並配置OpenVPN
Step 1 OpenVPN安裝配置
1.1 下載openvpn 並安裝
· 下載openvpn-2.0.5-gui-1.0.3版,地址 http://openvpn.se/files/install_packages/openvpn-2.0.5-gui-1.0.3-install.exe,安裝。(例如:安裝到F:\OPENVPN目錄下,下文舉例都用此目錄)
· 安裝完成後生成一個新網卡,並在網路連接里出現本地連接[X],把tcp/ip屬性改成手動配置,192.168.10.1(根據實際情況更改) ,255.255.255.0,其餘不填。
1.2 生成證書
· 修改F:\OpenVPN\easy-rsa\vars.bat.sample的以下部分
CODE:
set HOME=%ProgramFiles%\OpenVPN\easy-rsa
set KEY_COUNTRY=US
set KEY_PROVINCE=CA
set KEY_CITY=SanFrancisco
set KEY_ORG=FortFunston
set [email protected]
(請根據自身情況修改)改為
CODE:
set HOME=F:\OpenVPN\easy-rsa
set KEY_COUNTRY=CN
set KEY_PROVINCE=Hubei
set KEY_CITY=Wuhan
set KEY_ORG=51NB
set [email protected]
· 生成證書
o OpenVPN 有兩種安全模式,一種基於使用 RSA 證書和密鑰的 SSL/TLS,一種使用預先分享的靜態密鑰。本文採用SSL/TLS 模式。TLS模式的優點是安全,而且便於管理用戶。默認情況下證書和用戶是一對一的,多個用戶使用同一證書會被踢出。
o 開始-->運行-->鍵入cmd,回車,進入命令提示符-->進入F:\OpenVPN\easy-rsa目錄
QUOTE:
F:\OpenVPN\easy-rsa>
o 執行如下命令
CODE:
init-config
QUOTE:
F:\OpenVPN\easy-rsa>init-config
F:\OpenVPN\easy-rsa>copy vars.bat.sample vars.bat
已復制 1 個文件。
F:\OpenVPN\easy-rsa>copy openssl.cnf.sample openssl.cnf
已復制 1 個文件。
CODE:
vars
CODE:
clean-all
QUOTE:
F:\OpenVPN\easy-rsa>vars
F:\OpenVPN\easy-rsa>clean-all
系統找不到指定的文件。
已復制 1 個文件。
已復制 1 個文件。
CODE:
vars
build-ca
build-dh
QUOTE:
F:\OpenVPN\easy-rsa>vars
F:\OpenVPN\easy-rsa>build-ca #生成根證書
Loading 'screen' into random state - done
Generating a 1024 bit RSA private key
writing new private key to 'keys\ca.key'
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [CN]:
State or Province Name (full name) [Hubei]:
Locality Name (eg, city) [Wuhan]:
Organization Name (eg, company) [51NB]:
Organizational Unit Name (eg, section) []:CMWAP
Common Name (eg, your name or your server's hostname) []:fangzy #填自己的名字
Email Address [[email protected]]:
F:\OpenVPN\easy-rsa>build-dh #這個有點慢,估計要半分鍾
Loading 'screen' into random state - done
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
CODE:
build-key-server server
QUOTE:
F:\OpenVPN\easy-rsa>build-key-server server #生成伺服器端的密鑰,server為伺服器名
Loading 'screen' into random state - done
Generating a 1024 bit RSA private key
writing new private key to 'keys\server.key'
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [CN]:
State or Province Name (full name) [Hubei]:
Locality Name (eg, city) [Wuhan]:
Organization Name (eg, company) [51NB]:
Organizational Unit Name (eg, section) []:CMWAP
Common Name (eg, your name or your server's hostname) []:server #填自己的名字
Email Address [[email protected]]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:xxxx #輸入4位以上的密碼
An optional company name []:
Using configuration from openssl.cnf
Loading 'screen' into random state - done
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'Hubei'
localityName :PRINTABLE:'Wuhan'
organizationName :PRINTABLE:'51NB'
organizationalUnitName:PRINTABLE:'CMWAP'
commonName :PRINTABLE:'server'
emailAddress :IA5STRING:'[email protected]'
Certificate is to be certified until Feb 1 05:30:29 2016 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
CODE:
build-key client
QUOTE:
F:\OpenVPN\easy-rsa>build-key client #生成客戶端的密鑰,client為用戶名
Loading 'screen' into random state - done
Generating a 1024 bit RSA private key
writing new private key to 'keys\client.key'
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [CN]:
State or Province Name (full name) [Hubei]:
Locality Name (eg, city) [Wuhan]:
Organization Name (eg, company) [51NB]:
Organizational Unit Name (eg, section) []:CMWAP
Common Name (eg, your name or your server's hostname) []:client
Email Address [[email protected]]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:xxxx
An optional company name []:
Using configuration from openssl.cnf
Loading 'screen' into random state - done
DEBUG[load_index]: unique_subject = "yes"
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'Hubei'
localityName :PRINTABLE:'Wuhan'
organizationName :PRINTABLE:'51NB'
organizationalUnitName:PRINTABLE:'CMWAP'
commonName :PRINTABLE:'client'
emailAddress :IA5STRING:'[email protected]'
Certificate is to be certified until Feb 1 05:31:40 2016 GMT (3650 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
生成多個客戶端密鑰,執行build-key client1 …… build-key xyz。
復制證書文件
剛才生成的證書文件在F:\OpenVPN\easy-rsa\keys下,伺服器端需要的文件為ca.crt,dh1024.pem,server.crt,server.key ,客戶端需要的文件為:ca.crt client.crt client.key(xxx.crt xxx.key),配置.ovpn文件時需要用到。
1.3 配置server.ovpn文件
· 在\OpenVPN\config目錄下創建server.ovpn文件將ca.crt,dh1024.pem,server.crt,server.key復制到F:\OpenVPN\config目錄下
· 伺服器端文件示例:
server.ovpn
CODE:
port 1198
proto tcp-server
dev tun
server 192.168.10.0 255.255.255.0
keepalive 20 180
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
push "redirect-gateway def1"
push "dhcp-option DNS 192.168.10.1"
mode server
tls-server
status openvpn-status.log
comp-lzo
verb 4
1.4 客戶端安裝與配置
o 安裝OpenVPN,同1.1,但是不用更改本地連接設置。
o 配置OpenVPN
§ 在\OpenVPN\config目錄下創建client.ovpn文件,將ca.crt client.crt client.key 復制到 \OpenVPN\config
目錄下,這3個文件由伺服器端生成並發放。
§ 客戶端文件示例:
client.ovpn
CODE:
client
dev tun
proto tcp-client
remote jacky.10dig.com 1198 #這里填入remote server add,可用IP或者域名,
#若Server是動態IP,可到http://www.wingdns.com/注冊動態域名綁定動態IP。
#如Client所連接Server使用路由上網,則需要使用NAT將地址映射到Server端。
resolv-retry infinite
nobind
http-proxy 10.0.0.172 80 #這里填入你的代理伺服器地址和埠,沒有代理則不用這行
mute-replay-warnings
ca ca.crt
cert client.crt #這里改成每個客戶端相應的證書
key client.key #這里改成每個客戶端相應的證書
comp-lzo
verb 4
status openvpn-status.log
右擊openvpn-gui圖標,點connect,即可連接。
The End
Thank you for your reading...
2、如何配置OpenVPN使用用戶
我有
3、PPTP和OpenVPN有什麼區別?
PPTP點對點隧道協議(PPTP)是一種實現虛擬專用網路的方法。 PPTP使用用於封裝PPP數據包的TCP及GRE隧道控制通道。
OpenVPNOpenVPN是一免費開源軟體,以路由器或橋接配置和遠程訪問設備方式實現虛擬專用網路(VPN)創建安全的點對點或站對站連接的解決方案。它使用SSL / TLS安全加密,具有穿越網路地址轉換(NATs)和防火牆的功能。
在PPTP和OpenVPN二者之間做出選擇的一個重要考慮因素,也是我們無法控制的因素,就是有時互聯網服務供應商會阻止PPTP連接。次情況下我們無計可施,只能選擇使用OpenVPN。 PPTP具有一些獨特優勢,但此刻用OpenVPN會是不錯的選擇。
PPTP可以應用到幾乎所有的操作系統軟體,無需安裝任何軟體。它也兼容許多移動設備,如iphone,ipad和Windows移動,安裝簡易。相比之下,OpenVPN的安裝比PPTP要復雜一點,但只要按照正確的指示安裝則無太大困難。請注意OpenVPN不兼容移動設備。
PPTP加密技術使用密碼作為密鑰,它的數據流載有可獲取的混編密碼。如果中間有人攔截到了數據流並且破譯了密碼(盡管可能但很難),那麼他就可以破譯你的信息。然而OpenVPN使用非常強大的加密(Blowfish)技術。即使有人攔截你的數據流,他們也無計可施。這使得OpenVPN比PPTP安全得多。
選擇如果你希望得到高安全性以及更加關注數據安全傳輸問題,那麼你應該使用OpenVPN。如果您為了簡便或者想在移動設備上使用VPN那麼PPTP適合你。還有其他協議,例如L2P或IPSec,但他們在用戶友好或成本上沒有優勢。
4、使用花生殼怎樣搭建Openvpn
O
5、如何使用OpenVPN和PrivacyIDEA搭建雙因素認證的遠程接入
第一種,使用PAM的privacyidea_pam.py模塊。OpneVPN使用PAM認證,PAM調用privacyidea_pam.py模塊和PrivacyIDEA做驗證。
第二種,直接集成OpenVPN和FreeRADIUS。OpenVPN使用radius認證,FreeRADIUS向PrivacyIDEA驗證。
第三種,在OpenVPN中使用RADIUS的PAM模塊。
6、Windows 7上OpenVPN怎麼設置使用
從問題來看只是安裝了OpenVPN,但是沒有對其進行配置。此外OpenVPN分伺服器端和客戶端(安裝程序一樣,只是配置文件不一樣)。
OpenVPN客戶端不是安裝了就能用,需要伺服器端才能起作用。比如OpenVPN客戶端裝在Windows 7筆記本上,伺服器端用的是Windows2003 VPS。
需要進行的操作為:
(1)對伺服器端進行設置
(2)在伺服器端並生成相應的文件(包括server.ovpn, ca.crt, client.key, client.crt),確保配置正確後啟動伺服器端。
(3)復制客戶端需要的文件(ca.crt, client.key, client.crt)到客戶端,製作client.ovpn,啟動客戶端連接伺服器端。
7、如何給OPENVPN客戶端設置指定IP
我使用的是Opendoor vpn