ubuntu自动安装pptpd vpn

#!/bin/bash
apt-get update
apt-get install pptpd  #安装pptpd服务
vpnpass=`openssl rand 6 -base64` #生成随机密码
echo "vpn * ${vpnpass} *" >> /etc/ppp/chap-secrets #写入验证帐号密码
echo "localip 172.16.36.1">>/etc/pptpd.conf  #设置本地IP
echo "remoteip 192.168.10.100-200">>/etc/pptpd.conf  #设置远程IP段
echo "ms-dns 8.8.8.8">>/etc/ppp/pptpd-options         #设置推送dns IP
sed -i 's/#net.ipv4.ip_forward/net.ipv4.ip_forward/g' /etc/sysctl.conf   #开启IPV4转发
echo "iptables -t nat -A POSTROUTING -j MASQUERADE">>/etc/rc.local   #开机执行iptables
iptables -t nat -A POSTROUTING -j MASQUERADE   #执行iptables
/etc/init.d/pptpd restart      #重启pptpd服务
echo "VPN service is installed, VPN username is vpn, password is ${vpnpass}"
或者可可以直接
wget http://down.kvm.la/shell/ubuntu-vpn.sh;sh ubuntu-vpn.sh

添加新评论 »