擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

Aug-25-10

用 NM 設定 NXHX vpn

posted by Thomas

NXHX 的 vpn 走得是 pptp 協定,其中有一寫選項比較特別,要手動處理,Linux NetworkManager 也不像M$ 第一次會自動偵測(雖然不可靠XD)…
不過有手動連線的經驗之後,看那些選項,大概可以知道怎麼操作。

要先有套件 dpkg -l | grep pptp
ii  network-manager-pptp                 0.8-0ubuntu3   network management framework (PPTP plugin)
ii  network-manager-pptp-gnome       0.8-0ubuntu3  network management framework (PPTP plugin
ii  pptp-linux                                  1.7.2-4           Point-to-Point Tunneling Protocol (PPTP) Cli

在右上角NM(NetworkManager)圖示點選,底下有vpn,可以找到設置vpn。

新增連線,點選vpn的label,按下右邊的加入。

vpn 類型選 pptp。

輸入gateway, account, password

選 Advanced,只勾PAP,下有一些選項,Use tcp header compress 不要勾。

另外要設定140.110.16.1為dns,就是在IPv4設定為”只有自動VPN位址”,地下可以輸入DNS。

Oct-22-09

NXHX PPTP 手動設定

posted by Thomas

修改自 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