ovpn.sh 1.0 KB

12345678910111213141516171819202122
  1. # install openvpn
  2. wget -O /etc/openvpn/openvpn.zip "https://github.com/khairilg/script-jualan-ssh-vpn/raw/master/conf/openvpn-key.zip"
  3. cd /etc/openvpn/
  4. unzip openvpn.zip
  5. wget -O /etc/openvpn/1194.conf "https://raw.githubusercontent.com/khairilg/script-jualan-ssh-vpn/master/conf/1194-centos.conf"
  6. if [ "$OS" == "x86_64" ]; then
  7. wget -O /etc/openvpn/1194.conf "https://raw.githubusercontent.com/khairilg/script-jualan-ssh-vpn/master/conf/1194-centos64.conf"
  8. fi
  9. wget -O /etc/iptables.up.rules "https://raw.githubusercontent.com/khairilg/script-jualan-ssh-vpn/master/conf/iptables.up.rules"
  10. sed -i '$ i\iptables-restore < /etc/iptables.up.rules' /etc/rc.local
  11. sed -i '$ i\iptables-restore < /etc/iptables.up.rules' /etc/rc.d/rc.local
  12. MYIP=`curl icanhazip.com`;
  13. MYIP2="s/xxxxxxxxx/$MYIP/g";
  14. sed -i $MYIP2 /etc/iptables.up.rules;
  15. sed -i 's/venet0/eth0/g' /etc/iptables.up.rules
  16. iptables-restore < /etc/iptables.up.rules
  17. sysctl -w net.ipv4.ip_forward=1
  18. sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
  19. service openvpn restart
  20. chkconfig openvpn on
  21. cd