wiki:waue/2011/0401

NXHX PPTP 手動設定

修改自 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 認証,允許不加密資料…
  1. 建立 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
….
  1. 建立 or 修改 /etc/ppp/pap-secrets: 因為我們用的是pap認証,所以要改這個檔案,也時候也可能要改的檔案是 chap-secrets…所以要看你的認証方式而定

$USERNAME PPTP $PASSWORD *

  1. 建立 /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 因為我們不需要 所以拿掉了

  1. 用 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:….
    
  2. 斷線:
    poff nchc
    
  3. 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
  1. 在NXHX還要改 DNS 140.110.16.1
  1. 開機時啟動 edit 2010/09/29
    vi /etc/network/interfaces
    auto ppp0
    iface ppp0 inet ppp
    provider nchc
    

這樣就大功告成啦!

10 . option 需要視情況調整

#text
passive
connect-delay 10000
#lcp-echo-interval 30
#lcp-echo-failure 4
避免斷線…
  1. 最後用sshfs 掛載遠端目錄
    sshfs 主機:遠端目錄/ 本機目錄/
    fusermount 本機目錄/
    

本篇網址:http://www.libthomas.org/~thomas/wp/?p=574

更多細節參考

http://pptpclient.sourceforge.net/howto-debian.phtml

Last modified 10 years ago Last modified on May 2, 2011, 3:20:43 PM