-
-
Save pir2/3716139 to your computer and use it in GitHub Desktop.
This file contains 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 | |
#OpenVPN Server on CentOS OpenVZ VPS Script by Yasyf Mohamedali (http://blog.yasyf.com/2012/08/01/openvpn-server-on-a-centos-openvz-vps) | |
#Adapted from various scripts around the net, including http://www.openvz.ca/blog/2010/11/18/setup-tuntap-openvpn-server-openvz-5-minutes/ | |
#https://gist.github.com/3230440 | |
tunstate=`cat /dev/net/tun` | |
if [ "$tunstate" = "cat: /dev/net/tun: Permission denied" ] | |
then | |
clear | |
echo "Sorry, but it seems that TUN/TAP is not enabled on your VPS." | |
exit | |
fi | |
###Determine Internal or External IP Address for OPENVPN | |
read -p "Which IP do you want to use [I,E]?" IPADDRESSCHOICE | |
echo $IPADDRESSCHOICE | |
if [ "$IPADDRESSCHOICE" = "E" ] | |
then | |
ip=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-venet0:0 | awk -F= '{print $2}'` | |
elif [ "$IPADDRESSCHOICE" = "I" ] | |
then | |
ip=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-venet0:1 | awk -F= '{print $2}'` | |
fi | |
echo $ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment