Install openVPN on CentOS 5&6 FIX error

Diskusi tentang Ubuntu Server baik webserver, database server, samba server dan service lainnya serta jaringan menggunakan Sistem Operasi Ubuntu.
Post Reply
User avatar
sys4n32
Contact:

Install openVPN on CentOS 5&6 FIX error

Post 05 Dec 2013, 21:24

Install OpenVPN On CentOS

Pastikan OS anda apa,

Code: Select all

uname -a
Pastikan tun/tap sudah aktiv :)

Code: Select all

cat /dev/net/tun
Pastikan balasannya : file descriptor in bad state tandanya sudak aktiv

Masukan perintah berikut :
CENTOS 5 32bit

Code: Select all

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm/
CENTOS 5 64bit

Code: Select all

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
CENTOS 6 32 bit

Code: Select all

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
CENTOS 6 64bit

Code: Select all

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
ALL CENTOS 5

Code: Select all

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

Code: Select all

rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm

Code: Select all

rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
ALL CENTOS 6

Code: Select all

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
(abaikan jika gagal)

Code: Select all

rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm]
rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm

Code: Select all

yum install openvpn -y

Code: Select all

cp -r /usr/share/doc/openvpn-2.2.2/easy-rsa/ /etc/openvpn/
Jika error
`/usr/share/doc/openvpn-2.2.2/easy-rsa/�:
Masukkan download manual easy-rsa nya

Code: Select all

wget wget https://github.com/downloads/OpenVPN/easy-rsa/easy-rsa-2.2.0_master.tar.gz
extrak

Code: Select all

tar -zxvf easy-rsa-2.2.0_master.tar.gz
copy ke Openvpn

Code: Select all

cp -R easy-rsa-2.2.0_master/easy-rsa/ /etc/openvpn/
Opsi untuk yg belum ada nano

Code: Select all

yum -y install nano
Setelah itu

Code: Select all

nano /etc/openvpn/easy-rsa/2.0/vars
kemudian EDIT baris berikut : Ingat, hanya untuk CentOS 6
export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`
MENJADI :
export KEY_CONFIG=/etc/openvpn/easy-rsa/2.0/openssl-1.0.0.cnf
kemudian SAVE (Ctrl+x) (Y) (ENTER)

Pinda folder

Code: Select all

cd /etc/openvpn/easy-rsa/2.0/
Lalu ketikkan

Code: Select all

chmod +x *
source ./vars
./vars
./clean-all
./build-ca
cukup Enter Semua KECUALI COMMON NAME (isi sesuai keinginan)
Lalu masukkan kode

Code: Select all

./build-key-server server
Common name tidak usah disi tidak apa-apa, hanya lihat jika ada kode yes, tkan Y. Lajut

Code: Select all

./build-dh
Tunggu je, jika sudah selesai kode ini masukkan

Code: Select all

cp -r /etc/openvpn/easy-rsa/2.0/keys/ /etc/openvpn/keys/
cp /etc/openvpn/keys/ca.crt /etc/openvpn/ 
Pindah folder

Code: Select all

cd /etc/openvpn/
Membuat Response ke TUN driver

Code: Select all

cat > server.conf <<END
dev tun*
END 
Membuat Configurasi server :

Code: Select all

cat > groundworld.conf <<END
port 110 (pakai port yang belum dipakai)
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

Code: Select all

echo 1 > /proc/sys/net/ipv4/ip_forward
Iptables Route rules

Code: Select all

iptables -t nat -A POSTROUTING -s 10.9.8.0/24 -o venet0 -j SNAT --to IPVPS
Jalankan VPN di server :

Code: Select all

service openvpn start
Jika Fail, masukkan kode

Code: Select all

nano /var/log/messages
lihat apa yang error.
jika can't load plugin dan bla..bla..bla

masukkan kode ini

32 Bit

Code: Select all

wget http://safesrv.net/public/dl/openvpn-auth-pam.zip
64 Bit

Code: Select all

wget http://safesrv.net/public/openvpn-auth-pam.zip
unzip

Code: Select all

unzip openvpn-auth-pam.zip
baru pinda ke openvpn

Code: Select all

mv openvpn-auth-pam.so /etc/openvpn/openvpn-auth-pam.so
jika file sudah ada maka akan muncul pesan jika file sudah ada :)
baru buka lagi groundworld.conf

Code: Select all

nano groundworld.conf
ganiti baris kode ini

Code: Select all

plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login
ke

Code: Select all

plugin /etc/openvpn/openvpn-auth-pam.so /etc/pam.d/login
Edit file di /etc/sysctl.conf

Code: Select all

nano /etc/sysctl.conf
Ganti net.ipv4.ip_forward = ke net.ipv4.ip_forward = 1

save ctrl+x Y enter

Setelah itu restart openvpn

Code: Select all

service openvpn restart
Buat Client Config :

Code: Select all

cat > groundworld.ovpn <<END
client
dev tun
proto tcp
remote ip vps gan [spasi] port agan (sesuai settingan groundworld.conf)
resolv-retry infinite
route-method exe
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
verb 3
END
sekarang kita paketin :

Code: Select all

tar -czvf config.tar.gz ca.crt groundworld.ovpn
cp config.tar.gz /root
config.tar.gz di download via sftp windows di directory /root, jika kesulitan, kalo sudah ada httpd bisa dicopy ke sini :

Code: Select all

cp config.tar.gz /var/www/html/
Silahkan file di download di http://IpVPSagan/config.tar.gz
contoh http://19.19.19.19/config.tar.gz


Tinggal Pindahkan Downloadan Config tadi, ekstrak menggunakan 7-Zip
dan pindahkan ke C > program files > openvpn > config

download openvpn portable disini :
http://sourceforge.net/projects/ovpnp/f ... t/download
kemudian install ke forlder yang agan suka :)

setelah itu masuk ke folder, dan extrak file yang tadi di download :)
OpenVPNPortable > data > config
jka masih tidak bisa login, coba bikin file baru dengan extensi *.ovpn dengan notepad, isinya kurang lebih dibawah
Ex : hostingindo.ovpn

Code: Select all

client
dev tun
proto tcp
remote ip vps agan 110
route 0.0.0.0 0.0.0.0
resolv-retry infinite
route-method exe
resolv-retry infinite
nobind
persist-key
persist-tun
auth-user-pass pass.txt
comp-lzo
verb 3
ca ca.crt
config.tar.gz
PERHATIAN !!
UNTUK MENGGUNAKAN CONFIG DIATAS BUAT FILE PASS.TXT
GUNAKAN NOTEPAD
username
password
Contoh
kuda
kuda
simpan di folder OpenVPNPortabel > data > config

Semoga bermanfaat, by Keik Bucketheadland :)[size:14pt][/size]


User avatar
q_p
Contact:

Post 05 Dec 2013, 22:33

Kok CentOS ya :confused: ?


User avatar
sys4n32
Contact:

Post 06 Dec 2013, 08:12

iya mas, :)
bukannya kurang lebih, hhee, tinggal ganti yum dengan apt-get?

CMIW


User avatar
yanmix

Post 08 Jan 2014, 18:47

bisa bantu om ??
saya dah ngikutin cara diatas masih gk bisa..
ss http://prntscr.com/2hj1th


User avatar
nif

Post 09 Jan 2014, 09:24

q_p wrote:Kok CentOS ya :confused: ?
setuju. mungkin agak kurang nyambung kalo bahas trobleshooting CentOS di forum Ubuntu :D
lebih tepat jika dibahas di forum CentOS sendiri, atau forum lain yang tidak spesifik distro, semisal http://forum.pos-id.org/ atau http://forum.linux.or.id/

cmiiw


Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests