Skip to content

Instantly share code, notes, and snippets.

@martijnw
Forked from jinzhu/ArchLinux VPN
Created May 18, 2016 21:58
Show Gist options
  • Save martijnw/32c31886b4a7fc2a4c546276d154a43a to your computer and use it in GitHub Desktop.
Save martijnw/32c31886b4a7fc2a4c546276d154a43a to your computer and use it in GitHub Desktop.
a script to quick setup vpn server in archlinux
#!/bin/bash
# [email protected]
# thanks sushiyant ([email protected])
pacman -S iptables pptpd
echo "iptables -A INPUT -i ppp+ -j ACCEPT" >> /etc/rc.local
echo "iptables -A OUTPUT -o ppp+ -j ACCEPT" >> /etc/rc.local
echo "iptables -A INPUT -p tcp --dport 1723 -j ACCEPT" >> /etc/rc.local
echo "iptables -A INPUT -p 47 -j ACCEPT" >> /etc/rc.local
echo "iptables -A OUTPUT -p 47 -j ACCEPT" >> /etc/rc.local
echo "iptables -F FORWARD" >> /etc/rc.local
echo "iptables -A FORWARD -j ACCEPT" >> /etc/rc.local
echo "iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE" >> /etc/rc.local
echo "iptables -A POSTROUTING -t nat -o ppp+ -j MASQUERADE" >> /etc/rc.local
echo "iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE" >> /etc/rc.local
echo "echo 1 > /proc/sys/net/ipv4/ip_forward" >> /etc/rc.local
echo "option /etc/ppp/pptpd-options" >> /etc/pptpd.conf
echo "localip 192.168.0.1" >> /etc/pptpd.conf
echo "remoteip 192.168.0.234-238,192.168.0.245" >> /etc/pptpd.conf
touch /etc/ppp/pptpd-options
echo "name pptpd" >> /etc/ppp/pptpd-options
echo "refuse-pap" >> /etc/ppp/pptpd-options
echo "refuse-chap" >> /etc/ppp/pptpd-options
echo "refuse-mschap" >> /etc/ppp/pptpd-options
echo "require-mschap-v2" >> /etc/ppp/pptpd-options
echo "require-mppe-128" >> /etc/ppp/pptpd-options
echo "proxyarp" >> /etc/ppp/pptpd-options
echo "lock" >> /etc/ppp/pptpd-options
echo "nobsdcomp" >> /etc/ppp/pptpd-options
echo "novj" >> /etc/ppp/pptpd-options
echo "novjccomp" >> /etc/ppp/pptpd-options
echo "nologfd" >> /etc/ppp/pptpd-options
echo "ms-dns 8.8.8.8" >> /etc/ppp/pptpd-options
echo "ms-dns 8.8.4.4" >> /etc/ppp/pptpd-options
echo "vpn_user pptpd vpn_password *" >> /etc/ppp/chap-secrets
/etc/rc.local
/etc/rc.d/pptpd start
echo "VPN service is installed , Your VPN username is vpn_user , VPN password is vpn_password"
echo "To have pptpd server in any boot add it to DAEMONS=(... pptpd ...)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment