PPTP 客户端无法通过命令行连接

PPTP 客户端无法通过命令行连接

我需要连接到 PPTP VPN 才能通过 SSH 访问一些机器。

我使用的机器是 Ubuntu 14.04 Server。

/etc/ppp/peers/vpn我是这样设置的:

pty "pptp 1.2.3.4 --nolaunchpppd"
name domain\\user
remotename vpn
require-mppe-128
mppe-stateful
file /etc/ppp/options.pptp
ipparam vpn

/etc/ppp/options.pptp包含以下内容:

lock
noauth
refuse-pap
refuse-eap    
refuse-chap
refuse-mschap

nobsdcomp
nodeflate
nodefaultroute  

就像/etc/ppp/chap-secrets这样:

domain\\user vpn "secret" *

但是当我调用它时sudo pon vpn它却不运行。

这是我的syslog

pppd[11138]: pppd 2.4.5 started by secret-user, uid 0
pppd[11138]: Using interface ppp0
pppd[11138]: Connect: ppp0 <--> /dev/pts/0
pptp[11141]: anon log[main:pptp.c:314]: The synchronous pptp option is NOT activated
pptp[11210]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
pptp[11210]: anon log[ctrlp_disp:pptp_ctrl.c:739]: Received Start Control Connection Reply
pptp[11210]: anon log[ctrlp_disp:pptp_ctrl.c:773]: Client connection established.
pptp[11210]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
pptp[11210]: anon log[ctrlp_disp:pptp_ctrl.c:858]: Received Outgoing Call Reply.
pptp[11210]: anon log[ctrlp_disp:pptp_ctrl.c:897]: Outgoing call established (call ID 0, peer's call ID 62964).
pptp[11210]: anon log[logecho:pptp_ctrl.c:677]: Echo Request received.
pptp[11210]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 6 'Echo-Reply'
pptp[11210]: anon log[logecho:pptp_ctrl.c:677]: Echo Request received.
pptp[11210]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 6 'Echo-Reply'
pptp[11210]: anon log[logecho:pptp_ctrl.c:677]: Echo Reply received.
pptp[11210]: anon log[ctrlp_disp:pptp_ctrl.c:912]: Received Call Clear Request.
pptp[11210]: anon log[pptp_read_some:pptp_ctrl.c:544]: read returned zero, peer has closed
pptp[11210]: anon log[callmgr_main:pptp_callmgr.c:258]: Closing connection (shutdown)
pptp[11210]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 12 'Call-Clear-Request'
pptp[11210]: anon log[pptp_read_some:pptp_ctrl.c:544]: read returned zero, peer has closed
pptp[11210]: anon log[call_callback:pptp_callmgr.c:79]: Closing connection (call state)
pppd[11138]: Modem hangup
pppd[11138]: Connection terminated.
pppd[11138]: Exit.

答案1

尝试使用此脚本将其保存为名称vpn

#!/bin/bash
function routeadd {
    route add -net xxx.xxx.xxx.xxx netmask yyy.yyy.yyy.yyy dev ppp0
}

function makepptp {
   echo pty \"pptp zzz.zzz.zzz.zzz --nolaunchpppd\" >> /etc/ppp/peers/vpn;
   echo remotename PPTP >> /etc/ppp/peers/vpn;
   echo require-mppe-128 >> /etc/ppp/peers/vpn;
   echo file /etc/ppp/options.pptp >> /etc/ppp/peers/vpn;
   echo ipparam vpn >> /etc/ppp/peers/vpn;
pppd call vpn &
}
if [ -a /etc/ppp/chap-secrets ];
        then
        rm /etc/ppp/chap-secrets
    echo $1 PPTP $2 '*' >> /etc/ppp/chap-secrets;
else
    echo $1 PPTP $2 '*' >> /etc/ppp/chap-secrets;
fi

if [ -e /etc/ppp/peers/vpn ];
    then
    rm /etc/ppp/peers/vpn;
    echo name $1 >> /etc/ppp/peers/vpn;
    makepptp;
    sleep 8;
    routeadd;
else
    echo name $1 >> /etc/ppp/peers/vpn;
    makepptp;
    sleep 8;
    routeadd;
fi

乌塞热

sudp /path_to_script/vpn 用户名 密码

在脚本中:

xxx.xxx.xxx.xxx - 代表您希望访问的 VPN 服务器背后的网络

yyy.yyy.yyy.yyy - 代表网络掩码

zzz.zzz.zzz.zzz-代表vpn服务器的ip。

相关内容