穿透防火牆-OpenVPN


OpenVPN.jpg

遇到這問題,第一個就是想到那套日本的SoftEther,但是後來便不再推出免費使用。且一定需要Licence key才能啟動,故只好轉向使用免費的OpenVPN
在Linux上,安裝OpenVPN,並設定成Server端。步驟如下:
1.安裝rpm。
2.將/usr/share/openvpn/easy-rsa整個目錄,複製到/etc/openvpn目錄下。
3.編輯vars檔,export D='/etc/openvpn',執行. ./vars。
4.執行./clean-all。
5.執行./build-ca產生ca.crt和ca.key檔案。
6.執行./build-dh產生Diffie-Hellman key。
7.執行./build-key-server server產生server.crt、server.csr和server.key。
8.執行./build-key client1產生client1.crt、client1.csr和client1.key。
9.編輯server.conf,依照需求修改其設定。
9.1 改為proto tcp 9.2 改push "route 192.168.X.0 255.255.255.0"
10.啟動openvpn。
11.Client端安裝(主要是Win32)。
12.將產生出來的ca.crt、client1.crt和client1.key,複製到C:\Program Files\OpenVPN\config目錄。
13.編輯client.ovpn。改成 proto tcp,指定剛產生的三個檔,ca ca.crt、cert client1.crt、key client1.key,remote public_ip_map_to_vpn_server 1194。
14.執行client.ovpn,便可連上Server。

這過程發生找不到ca檔,必須在server.conf中,在ca ca.crt上指定路徑,Ex:ca keys/ca.crt,其他server.crt、server.key、dh1024.pem皆需要。
另外,產生server.crt時,可能檔案大小為0,此時必須重新產生。
當然如果使用port 443,需將Apache conf檔,將443 port disable。
在Windows上,如需GUI畫面,可以另外下載OpenVPN GUI for Windows
此方法必須允許觀看網頁,如果公司連網頁都不能看,此方法無效。
參考資料:OpenVPN HOWTO
How to reach any of the other machines on the remote subnet.
1. On Ubuntu, You need to modify /etc/sysctl.conf, net.ipv4.conf.default.forwarding=1.
2. Add a static routing in default gateway, ex 10.8.0.0 netmask 255.255.255.0 VPN_Server_IP.

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Archives

Powered by Movable Type 4.34-en

About this Entry

This page contains a single entry by philipz published on February 23, 2008 5:57 PM.

AS/400 CL command reference was the previous entry in this blog.

MARQUIS Who's Who in the World 提名函 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.