-
-
Save llj098/4362145 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $(id -u) != "0" ]; then | |
printf "Error: You must be root to run this tool!\n" | |
exit 1 | |
fi | |
clear | |
printf " | |
#################################################### | |
# # | |
# This is a Shell-Based tool of pptp installation # | |
# Version: 0.1 # | |
# Author: Bruce Ku # | |
# For Debian/Ubuntu 32bit and 64bit # | |
# # | |
#################################################### | |
" | |
vpsip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk 'NR==1 { print $1}'` | |
apt-get update | |
apt-get --purge remove pptpd ppp | |
rm -rf /etc/pptpd.conf | |
rm -rf /etc/ppp | |
apt-get install -y ppp | |
apt-get install -y pptpd | |
apt-get install -y iptables logrotate tar cpio perl | |
rm -r /dev/ppp | |
mknod /dev/ppp c 108 0 | |
sed -i 's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf | |
sysctl -p | |
echo "mknod /dev/ppp c 108 0" >> /etc/rc.local | |
echo "localip 172.16.36.1" >> /etc/pptpd.conf | |
echo "remoteip 172.16.36.2-254" >> /etc/pptpd.conf | |
echo "ms-dns 8.8.8.8" >> /etc/ppp/pptpd-options | |
echo "ms-dns 8.8.4.4" >> /etc/ppp/pptpd-options | |
echo "test * test123 *" >> /etc/ppp/chap-secrets | |
iptables -t nat -A POSTROUTING -s 172.16.36.0/24 -j SNAT --to-source "$vpsip" | |
iptables -A FORWARD -p tcp --syn -s 172.16.36.0/24 -j TCPMSS --set-mss 1356 | |
iptables-save > /etc/iptables-rule | |
echo "iptables-restore < /etc/iptables-rule" >> /etc/network/interfaces | |
printf " | |
#################################################### | |
# # | |
# This is a Shell-Based tool of pptp installation # | |
# Version: 0.1 # | |
# Author: Bruce Ku # | |
# For Debian/Ubuntu 32bit and 64bit # | |
# # | |
#################################################### | |
ServerIP:$vpsip | |
username:test | |
password:test123 | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iptables-save > /etc/iptables-rule
echo "iptables-restore < /etc/iptables-rule" >> /etc/network/interfaces`