You should modify some hard code.
server side
- $ cat setup-pptpd.sh
#!/bin/bash # install pptpd apt-get install -y pptpd # config pptpd echo "localip 192.168.2.1" >> /etc/pptpd.conf echo "remoteip 192.168.2.2-10" >> /etc/pptpd.conf echo "ms-dns 172.16.0.23" >> /etc/ppp/options.pptpd echo "ms-dns 8.8.8.8" >> /etc/ppp/options.pptpd # generate user's password passwd=`openssl rand 10 -base64` if [ "$1" != "" ] then passwd=$1 fi # setup authenticated user echo "user pptpd $passwd *" >> /etc/ppp/chap-secrets # for ipv4 forwarding sed -i 's/^#net.ipv4.ip_forward = 1/net.ipv4.ip_forward = 1/' \ /etc/sysctl.conf sysctl -p # use iptabes to get the net forward iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j SNAT \ --to-source $(ifconfig | grep 'inet addr:'| \ grep -v '127.0.0.1' | cut -d: -f2 \ | awk 'NR==1 { print $1}') iptables -A FORWARD -p tcp --syn -s 192.168.2.0/24 \ -j TCPMSS --set-mss 1356 service iptables save # make the iptables and pptpd auto start chkconfig iptables on chkconfig pptpd on service iptables start service pptpd start echo "VPN service is installed" echo "VPN username is user,VPN password is $passwd"
client side
$ cat setup-pptp-client.sh#!/bin/bash apt-get install -y pptp-linux # modify those variable for your environment vpn_server="1.2.3.4" user="user" passwd="secret" echo "pty \"pptp $vpn_server --nolaunchpppd\" name $user remotename pptpd require-mppe-128 file /etc/ppp/options.pptp ipparam pptpd" > /etc/ppp/peers/pptpd echo "$user pptpd $passwd *" >> /etc/ppp/chap-secrets echo "setup vpn client done." echo -e "now, you shoule run:" echo -e "\t$ pon pptpd # start pptpd"
echo -e "\t$ pon pptpd debug dump logfd 2 nodetach # debugging" echo -e "\t$ poff pptpd # stop pptpd" echo -e "\t$ ifconfig # check network config"
No comments:
Post a Comment
您的评论将使我blog更有动力~