debian 9 VPN pptp

 apt install pptp-linux

/etc/ppp/chap-secrets

SERVER\\USER PPTP PASS *

/etc/ppp/peers/VPNNAME

pty "/usr/sbin/pptp SERVER --nolaunchpppd"
name SERVER\\USER
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam VPNNAME

vpn start

 pon VPNNAME

vpn stop

 poff VPNNAME

vpn test

 pon VPNNAME debug dump logfd 2 nodetach

/etc/network/interfaces

auto ppp0
iface ppp0 inet ppp
        provider VPNNAME

aliase

auto ens32:0
iface ens32:0 inet static
        name ALIASFORVPN
        address 192.168.150.1
        netmask 255.255.255.0
        broadcast 192.168.150.255
        network 192.168.150.0

ip route
/etc/ppp/ip-up.d/NAME-route

#!/bin/bash
ip route add 192.168.0.0/16 dev ppp0 src 192.168.150.1
 chmod +x /etc/ppp/ip-up.d/NAME-route

Start if interface down by cron

#!/bin/bash
PPPT=`/sbin/ifconfig -a | grep 'ppp0' | gawk -F"<" '{print $2}' | gawk -F"," '{print $1}'`
DATE=`date`
PPP=`/sbin/ifconfig -a | grep 'ppp0'`
echo "PPP: $PPP"
if  [ "UP" != "$PPPT" ]
then
    echo "$DATE : Fail : $PPP"
    /usr/bin/pon lat updetach
else
    echo "$DATE : It's ok!"
fi

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

#!/bin/bash
 
HOST=enter_check_ip
 
DATE=`date`
PINGRES=`ping -c 2 $HOST`
PLOSS=`echo $PINGRES : | grep -oP '\d+(?=% packet loss)'`
 
echo "$DATE : Loss Result : $PLOSS"
 
if [ "100" -eq "$PLOSS" ]; then
    echo "$DATE : Starting : $HOST"
    /usr/bin/pon lat updetach
    echo "$DATE : Now running : $HOST"
else
    echo "$DATE : Already running : $HOST"
fi

crontab -e

*/1  * * * * cd /root/cron && ./pptp_start.sh >> /var/log/pptp_pinger.log 2>&1

iptables

iptables -A INPUT -p gre -j ACCEPT &&
iptables -A INPUT -m tcp -p tcp --dport 1723 -j ACCEPT
Только авторизованные участники могут оставлять комментарии.
  • blog/debian_9_pptp.txt
  • Последние изменения: 2019/12/05