欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 5486|回复: 0
收起左侧

[开源] debian vps安装pptp vpn脚本

[复制链接]
丶纠结灬 发表于 2014-1-24 20:28 | 显示全部楼层 |阅读模式
#!/bin/bash
function installVPN(){
        apt-get update
        #remove ppp pptpd
        rm -rf /etc/pptpd.conf
        rm -rf /etc/ppp
        apt-get -y remove ppp pptpd
        
        apt-get -y install ppp pptpd iptables
        echo ms-dns 208.67.222.222 >> /etc/ppp/pptpd-options
        echo ms-dns 208.67.220.220 >> /etc/ppp/pptpd-options
        echo localip 192.168.99.1 >> /etc/pptpd.conf
        echo remoteip 192.168.99.9-99 >> /etc/pptpd.conf

        iptables -t nat -A POSTROUTING -s 192.168.99.0/24 -j SNAT --to-source `ifconfig  | grep 'inet addr:'| grep -v '127.0.0' | cut -d: -f2 | awk 'NR==1 { print $1}'`
        sed -i 's/exit\ 0/#exit\ 0/' /etc/rc.local

        echo iptables -t nat -A POSTROUTING -s 192.168.99.0/24 -j SNAT --to-source `ifconfig  | grep 'inet addr:'| grep -v '127.0.0' | cut -d: -f2 | awk 'NR==1 { print $1}'` >> /etc/rc.local
        echo exit 0 >> /etc/rc.local
        echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf
        sysctl -p
        echo ystest \* intel \* >> /etc/ppp/chap-secrets
        /etc/init.d/pptpd restart
}

function repaireVPN(){
        echo "begin to repaire VPN";
        mknod /dev/ppp c 108 0
        /etc/init.d/pptpd restart
}

function addVPNuser(){
        echo "input user name:"
        read username
        echo "input password:"
        read userpassword
        echo "${username} pptpd ${userpassword} *" >> /etc/ppp/chap-secrets
        /etc/init.d/pptpd restart
}

echo "which do you want to?input the number."
echo "1. install VPN service"
echo "2. repaire VPN service"
echo "3. add VPN user"
read num

case "$num" in
[1] ) (installVPN);;
[2] ) (repaireVPN);;
[3] ) (addVPNuser);;
*) echo "nothing,exit";;
esac
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-5-6 10:03 , Processed in 0.039540 second(s), 9 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表