Sunday, August 12, 2007

Installasi VPN dengan openvpn

Seperti biasanya, tanpa cuap-cuap, saya langsung pada pokok permasalahan yaitu cara install vpn dengan openvpn
1. Install openvpn server
A. Program yang diperlukan
- Openvpn
Dapat di download di http://openvpn.net/release/openvpn-2.0.9.tar.gz
- bash dan gettext
Dapat di download di ftp.freebsd.org atau di site-site yang lain ( kalau bingung cari di google.com :-) )
B. Memulai installasi
1.
tar –xzvf openvpn-2.0.9.tar.gz ( extract file openvpn )
2. cd openvpn-2.0.9 ( masuk ke directory openvpn )
3. ./configure --disable-lzo ( melakukan configurasi openvpn )
4. make && make install ( memulai installasi )
5. cp -r /home/saudiheidi/openvpn-2.0.9/easy-rsa /etc/openvpn ( mengcopy source openvpn , misal ke /etc )
6. cd /etc/openvpn ( masuk ke directory baru openvpn )
7. bash clean-all ( atau ./clean-all )
8. bash bash build-ca ( atau ./build-ca )
9. bash build-key-server server ( atau ./build-key-server server ), membuat key server ( server.key )
10. bash build-dh
11. edit file server.conf ( file ada di easy-rsa/sample-configurataion )
misal isi server.conf

# Which local IP address should OpenVPN

# listen on? (optional)

local 10.10.9.1
port 1194
proto udp
dev tap0
ca ca.crt
cert server.crt
key server.key # This file should be kept secret

dh dh1024.pem

server-bridge 10.10.10.1 255.255.255.128 10.10.10.65. 10.10.10.81

client-to-client

keepalive 10 120

user nobody

group nobody

persist-key

persist-tun
verb 3

12. Buat Tunel
Tambahkan setting berikut di /etc/rc.conf ( misal )

ifconfig_vr0="inet x.x.x.x netmask 255.255.255.240"

ifconfig_rl0="inet 10.10.10.1 netmask 255.255.255.128"

gif_interfaces="gif0"

gifconfig_gif0="x.x.x.x y.y.y.y"

ifconfig_gif0="inet 10.10.9.1 10.10.9.2 netmask 255.255.255.248"

defaultrouter="x1.x1.x1.x1"

hostname="vpn.serverku"

Note : x ( ip fix anda )
y ( ip fix remote/vpn client )
x1 ( ip gateway anda )
13. Jalankan program openvpn
# cd /etc/openvpn
# openvpn /etc/openvpn/server.conf &
Jika tidak ada error berarti VPN Server anda sudah berjalan
14 Membuat key untuk client ( ini bisa dilakukan sebelum vpn dijalankan, maaf nulisnya
ndak urut )
bash build-key client ( atau ./build-key client )
B. Membuat key untuk client
- Installasi openvpn sama dengan installasi openvpn server
- Setting configurasi clinet.conf
- masukkan client.key dan client.crt ke directory /etc/openvpn
- Jalankan openvpn
- openvpn /etc/openvpn/client.conf &

C. Pengecheckan
Bisa dilakukan pengecheckan dgn ping ke ip tunel yg ada, misal
# ping 10.10.9.2
PING 10.10.9.2 (10.10.9.2): 56 data bytes
64 bytes from 10.10.9.2: icmp_seq=0 ttl=64 time=86.916 ms
64 bytes from 10.10.9.2: icmp_seq=1 ttl=64 time=121.256 ms
^C

Ok....................semoga bermanfaat

0 comments: