Loading

debian 安装 pptp 客户端

1. 安装

apt install pptp-linux

2. 连接

pptpsetup --create vpn-name --server ip --username name --password passwd --encrypt --start

3. 断开连接

poff vpn-name

4. 连接

pon vpn-name

5. 你可能会用到

route add -net 192.168.101.0/24 dev ppp0

6. 自启脚本参考

#!/bin/bash
### BEGIN INIT INFO
# Provides: vpn-pptp
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop node
# Description: vpn-pptp
### END INIT INFO

case $1 in
start)
        while true
        do
        has=`ip a | grep ppp | grep inet | wc -l`
        if [ $has -gt 0 ]
        then
        echo "sleep 5s"
        sleep 5
        else
        pon vpn
        sleep 5
        wc=`route -n | grep 192.168.101.0 | wc -l`
        if [ $wc -eq 0 ]
        then
            route add -net 192.168.101.0/24 dev ppp0
        fi
        echo "connected!"
        fi
        done
;;
stop)
        pid=`ps aux | grep /vpnd | grep -v grep | awk '{print $2}' | head -1`
        if [ -n $pid ]
        then
            kill -9 $pid & poff vpn
        fi
;;
status)
        pid=`ps aux | grep /vpnd | grep -v grep | awk '{print $2}' | head -1`
        if [ -n $pid ]
        then
                echo "vpnd is running."
        else
                echo "vpnd is stoped."
        fi
;;
*)
        echo "vpnd start|stop|status"
        exit 1
esac

exit 0

7. 参考连接

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

posted @ 2021-05-26 15:24  microestc  阅读(1036)  评论(0编辑  收藏  举报