如何設立虛擬網絡 how to setup VPN
如何設立VPN (Virtual Private Network)
市面上, 只要擁有VPN 功能的路由器就必所費不菲, 而且功能參差. 中小企的老闆希望建立安全網絡的話總得花一點錢. 這篇文章就是提供一個方案給主將網絡安全的老闆們. 分以下部份解說
- 什麼是 VPN
- 現時市面上的VPN方案
- 案例 - 以 Windows 機器登入 Linux PPTP服務器
- 方案對比
什麼是 VPN
VPN (Virtual Private Network) 虛擬內聯網. 就是通過一些加密 ( Encryption )技術把在外的使用者跟服務器的內部連接. 令使用者得到內聯網上的 ip 位置及權限. 概念圖如下
fig 1 

圖中的 vpn server 就代表辦公室 / 機樓. 在外的老闆們想進入公司網絡的話, 就可以經過 vpn 建立那條紅色的隧道. 這時候, vpn server 會派給在外的老闆一個地址 ( 192.168.1.200 ) 而老闆則同時間擁有兩個地址 1) 實質地址 ( 172.16.0.100 ) 2) 虛擬地址 ( 192.168.1.200 )
實質上, 老闆是靠 172.16.0.100 跟辦公室建立黃色的那一條 real encryption path 來傳送訊息. 而紅色的隧道只在 Logic 上存在.
要留心, 在老闆對上那藍色的路由器, 有時會阻礙 vpn 通道的建立. 因此, 可解決此問題的SSL-VPN 就成為近年的熱門.
現時市面上的VPN方案
現時市面上雖然有很多路由器可供選擇, 但VPN 技術二不離三, 主要分別在於認證技術, 約分為三類
- Ipsec VPN
- PPTP VPN
- SSL VPN
IPSEC VPN 原理是經驗兩重的認證, 在登入者與服務器間建立鑰匙 Session Key, 再用這條鑰匙作資料加密. 因為使用 Session Key 的關係, 加密速度會相對較快. 但在使用者的角度會造成不便, 因為認證需要認證書Certificate, 而且登入時可能需要加裝軟件.
注名的 Ipsec 有 Cisco VPN / 在 Linux 上運行的 Openswan
PPTP VPN(Point-to-Point Tunneling Protocol)是 Microsoft 開發的制式, 在所有 windows 上都不需要加裝軟件就能使用. 登入時使用名稱密碼, 是最方便的 VPN. 當然, 方便換來的是安全性較底.
SSL VPN 是近年熱門的方案, 因為某些地區網絡 (如酒店 / 學校 )不支援 VPN PASS THROUGH, PPTP VPN 跟 IPSEC VPN 都不起作用時, SSL VPN 依然可以如常運作. 某些 SSL VPN 如SSL-Explorer , 更可以讓使用者用溜覽器登入, 比 PPTP 更方便. 需要高安全性的, 可考慮 OpenVPN, 只需要數個步驟就可以安裝客戶端.
案例 – 以 Windows 機器登入 Linux PPTP 服務器
這個案例會介紹如何設立 LINUX PPTP 服務器, 及在 Windows 客戶端下的登入方法.
在 Linux 架設 VPN 服務器請輸入
#Sudo apt-get install pptpd
輸入以下兩句
#sudo vi /etc/pptpd.conf
localip 192.168.3.100
remoteip 192.168.3.234-238,192.168.3.245
- 192.168.3.100 需為你的 Linux IP 地址, 可用 ifconfig 找到, 在上面 fig1 的例子便是 192.168.1.1
- remoteip 就是你希望 vpn server 所指派的 ip 地址範圍
#sudo vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
keithyau PPTP 123456 *
請注意 ”server “ 需要輸入跟 中 name 一樣的名稱
#sudo vi /etc/ppp/pptpd-options
# Authentication
# Name of the local system for authentication purposes
# (must match the second field in /etc/ppp/chap-secrets entries)
name PPTP
Linux 客戶端之設定
在客戶端輸入 (即 fig 1 的老闆)
#sudo vi /etc/ppp/peers/conntecion-name
pty "pptp yourcompany.com --nolaunchpppd"
name keithyau
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam connection-name
keithyau = name of user
connection-name = file name of this file
yourcompany.com = fig 1 中的辦公室
#sudo vi /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret IP addresses
keithyau PPTP 123456 *
輸入跟服務器端一樣的使用者資料
連接服務器
#sudo pppd call connection-name
成功後, 會出現以下虛擬網絡卡
#/sbin/ifconfig
ppp0 Link encap:Point-to-Point Protocol
inet addr:192.168.3.234 P-t-P:192.168.3.100 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1496 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:62 (62.0 b) TX bytes:68 (68.0 b)
以虛擬網絡卡作傳送 #route add -net 192.168.3.0 dev ppp0
192.168.3.0 需因 ifconfig 結果調整
在 Windows 客戶端的設定
按以下步驟設定
-

- File → new connection



你的設定名稱
服務器位置


使用者名稱密碼
完成後可看到新的連線 (ppp adapter yubis-office)
方案對比 (1-3) 1=best
| IPSEC | PPTP | SSL VPN | |
| 防火墻穿透 | 3 | 2 | 1 |
| 安全性 | 1 | 3 | 2 |
| User friendly | 3 | 1 | 2 |
| 支援軟體 | 3 | 1 | 2 |
| 性能 | 2 | 3 | 1 |
| 可靠 Availability | 1 | 3 | 2 |
總括來,個人較喜歡 SSL VPN, 而且亦較識合中小企使用
在下一篇文章會介紹如何設定 ssl VPN
About this entry
You’re currently reading “如何設立虛擬網絡 how to setup VPN,” an entry on keithyau
- Published:
- January 23, 2009 / 4:03 pm
- Category:
- Information Technology, security
- Tags:
- Access, business IT solution, 網絡, security, virtual networking, 中小企
No comments yet
Jump to comment form | comment rss [?] | trackback uri [?]