修改自 PPTP Client Debian HOWTO by James Cameron 26th May 2008
These are instructions for installing PPTP Client on Debian GNU/Linux.
Contents:
* 安裝 Ubuntu pptp client
apt-get install pptp-linux
* 手動設定pptp連線
Configuration, by hand
1. obtain from your PPTP Server administrator:
* the IP address or host name of the server ($SERVER),
* the name you wish to use to refer to the tunnel ($TUNNEL),
* the authentication domain name ($DOMAIN),
* the username you are to use ($USERNAME),
* the password you are to use ($PASSWORD),
* whether encryption is required.
基本上要開始之前要對 VPN SERVER 有所了解,最起碼要知道ServerIP, Domain, Username, Password, 最容易告不清楚就是 “加密”與”壓縮”
以 NXHX公司為例
* $SERVER = 140.110.22.100
* $TUNNEL = nchc //自己定義就好
* $DOMAIN = //沒有
* $USERNAME = ….
* $PASSWORD = ….
* 以 pap 認証,允許不加密資料…
2. 建立 or 修改 /etc/ppp/options.pptp:
預設是 lock noauth nobsdcomp nodeflate refuse-pap refuse-chap refuse-eap refuse mschap
,而NXHX因為要用到PAP,所以把 refuse-pap 給住解掉。
# We won’t do PAP, EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2
# (you may need to remove these refusals if the server is not using MPPE)
#refuse-pap
refuse-eap
refuse-chap
refuse-mschap
….
3. 建立 or 修改 /etc/ppp/pap-secrets: //因為我們用的是pap認証,所以要改這個檔案,也時候也可能要改的檔案是 chap-secrets…所以要看你的認証方式而定
$USERNAME PPTP $PASSWORD *
4. 建立 /etc/ppp/peers/$TUNNEL:
vi /etc/ppp/peers/nchc
pty “pptp 140.110.22.100 –nolaunchpppd”
name $USERNAME
remotename PPTP
file /etc/ppp/options.pptp
ipparam nchc
Note: if you do not need MPPE support, then remove the require-mppe-128 option from this file and /etc/ppp/options.pptp.
// 原本範例有 require-mppe-128 因為我們不需要 所以拿掉了
5. 用 pon 來建立連線吧:
pon nchc
ifconfig 可以找到 ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:140.110.35.193 P-t-P:140.110.35.192 Mask:….
6. 斷線:
poff nchc
7. to set up routing: //這邊希望連線後預設路由就是VPN出去
route add default gw 140.110.35.192
or
vi /etc/ppp/ip-up.d/nchc
#!/bin/sh
if [ "${PPP_IPPARAM}" = "nchc" ]; then
/sbin/route add -net 140.x.0.0/16 dev ${IFNAME}
/sbin/route add -net 2xx.1xx.1xx.0/24 dev ${IFNAME}
fi
8. 在NXHX還要改 DNS 140.110.16.1
這樣就大功告成啦!
更多細節參考
http://pptpclient.sourceforge.net/howto-debian.phtml