Skip to content

Instantly share code, notes, and snippets.

@pir2
Created September 13, 2012 17:45
Show Gist options
  • Save pir2/3716139 to your computer and use it in GitHub Desktop.
Save pir2/3716139 to your computer and use it in GitHub Desktop.
#!/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