hope this will be useful
====================
1. Open Your VPS with putty
2. have to login with root access
---
ensure TUN /TAP is active
check it with type this command :
cat /dev/net/tun
the answer must be : file descriptor in bad state
---------------------------------
3. and then enter this command :
CENTOS 5 32bit
====================
1. Open Your VPS with putty
2. have to login with root access
---
ensure TUN /TAP is active
check it with type this command :
cat /dev/net/tun
the answer must be : file descriptor in bad state
---------------------------------
3. and then enter this command :
CENTOS 5 32bit
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
CENTOS 5 64bitwget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
CENTOS 6 32 bitwget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
CENTOS 6 64bitwget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
ALL CENTOS 5
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
ALL CENTOS 6
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt (abaikan jika gagal)
rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
yum install openvpn -y
cp -r /usr/share/doc/openvpn-2.2.2/easy-rsa/ /etc/openvpn/
TAKE A NOTE for CENTOS 6need a little modification
yum -y install nano
nano /etc/openvpn/easy-rsa/2.0/vars
then EDIT this line :
export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`
change line above with this :
export KEY_CONFIG=/etc/openvpn/easy-rsa/2.0/openssl-1.0.0.cnf
and then SAVE (Ctrl+x) (Y) (ENTER)
cd /etc/openvpn/easy-rsa/2.0/
chmod +x *
source ./vars
./vars
./clean-all
./build-ca
Just type enter, except for COMMON NAME (fill it with what ever you like)then :
./build-key-server server
Please take attentionwhen u got notification (twice) choose Y (y)
----------------------------------------
./build-dh
wait until its doneand then enter this command :
cp -r /etc/openvpn/easy-rsa/2.0/keys/ /etc/openvpn/keys/
cp /etc/openvpn/keys/ca.crt /etc/openvpn/
cd /etc/openvpn/
make response to TUN driver
cat > server.conf <<END
dev tun*
END
build server configuration :
cat > groundworld.conf <<END
port 443
proto tcp
dev tun
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login
client-cert-not-required
username-as-common-name
server 10.9.8.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 5 30
comp-lzo
persist-key
persist-tun
status server-tcp.log
verb 3
END
Forwarding Port
echo 1 > /proc/sys/net/ipv4/ip_forward
Iptables Route rules
iptables -t nat -A POSTROUTING -s 10.9.8.0/24 -o venet0 -j SNAT --to xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx above, change it with your vps address
run openvpn on the server
service openvpn start
chkconfig openvpn on
chkconfig --add openvpn
DONE !!