Setup OpenVPN di FreeBSD
- October 8th, 2011
- Posted in IT
- Write comment
Setelah baca-baca di forum fjb sepertinya sekarang mulai banyak lagi yang menjual account vpn. baik yang menjual hanya untuk anonymous surfing di internet, untuk menembus blokir situs di kantor dan kampus maupun yang menjual untuk trik gratisan di operator seluler.
Saya jadi penasaran bagaimana sih caranya membuat server VPN seperti yang lagi marak belakangan ini.Dari hasil searching di mbah google lalu di gabungkan akhirnya bisa juga membuat server vpn yang berjalan dengan lancar.. hehhehe….
Sebenarnya apa sih yang dimaksud dengan OpenVPN.
OpenVPN is a free and open source software application that implements virtual private network (VPN) solutions for creating secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It uses SSL/TLS security for encryption and is capable of traversing network address translators (NATs) and firewalls. It was written by James Yonan and is published under the GNU General Public License (GPL).
Seperti biasanya di sistem operasi FreeBSD kita diberi kemudahan untuk menginstall aplikasi menggunakan Ports, maka untuk menginstall OpenVPN ini saya juga menginstall menggunakan Ports
#cd /usr/ports/security/openvpn
#make && make install
Kemudian membuat direktori untuk konfigurasi dan mengcopy file konfigurasi untuk openvpn
#mkdir -p /usr/local/etc/openvpn
#mkdir -p /usr/local/etc/openvpn/keys
#cp -R /usr/local/share/doc/openvpn/ /usr/local/etc/openvpn/
#cd /usr/local/etc/openvpn
Setelah itu dilanjutkan dengan proses membuat certificate
1. pindah direktori aktif ke direktori tempat menyimpan script untuk mengenerate certificate
#cd /usr/local/etc/openvpn/easy-rsa/2.0/
#sh
#. ./vars
#./clean-all
2. membuat file ca.key
#./build-ca
3.membuat server key server.key
#./build-key-server server
4. membuat DH parameter
#./build-dh
5. membuat certificate untuk client, untuk bagian commonname harus diisi dengan nama user vpnnya
# ./build-key client1
6. mengcopy file key hasil generate tadi
#cp -R keys/* /usr/local/etc/openvpn/keys
7. mengcopy dan mengedit file konfigurasi untuk server
#cp /usr/local/share/doc/openvpn/sample-config-files/server.conf /usr/local/etc/openvpn/
#ee /usr/local/etc/openvpn/server.conf
up /usr/local/etc/openvpn/up.sh
down /usr/local/etc/openvpn/down.sh
port 1194
proto tcp
dev tap0
ca /usr/local/etc/openvpn/keys/ca.crt
cert /usr/local/etc/openvpn/keys/server.crt
key /usr/local/etc/openvpn/keys/server.key
dh /usr/local/etc/openvpn/keys/dh1024.pem
ifconfig-pool-persist ipp.txt
server-bridge 10.1.0.50 255.255.255.0 10.1.0.60 10.1.0.100
push “redirect-gateway def1 bypass-dhcp”
push “dhcp-option DNS 208.67.220.220″
client-to-client
keepalive 1 1200
comp-lzo
max-clients 40
;user nobody
;group nobody
persist-key
persist-tun
log-append /var/log/openvpn.log
verb 2
plugin /usr/local/lib/openvpn-auth-pam.so service-type
plugin /usr/local/lib/openvpn-auth-pam.so “login login USERNAME password PASSWORD”
8. merubah file rc.conf dan pf.conf
#ee /etc/rc.conf
tambahkan baris berikut
gateway_enable=”YES”
openvpn_enable=”YES”
openvpn_configfile=”/usr/local/etc/openvpn/server.conf”
openvpn_flags=”–script-security 2″
openvpn_if=”tap”
pf_enable=”YES”
pf_rules=”/etc/pf.conf”
pf_program=”/sbin/pfctl”
#ee /etc/pf.conf
tambahkan baris berikut
ext_if=”fxp0″
int_if=”vr0″
vpn_if=”bridge0″
set skip on lo
scrub in
#VPN Network
vpn_network=”10.1.0.0/24″
nat on $ext_if from $vpn_network to any -> ($ext_if)
pass in on $ext_if proto tcp from any to port 1194 keep state
pass quick on $vpn_if
9. load driver tap adapter waktu boot
masukkan baris berikut ke dalam file /boot/loader.conf
if_tap_load=”YES”
10. edit file syslog.conf agar mendukung log file dari openvpn
#ee /etc/syslog.conf
### added two lines below in the end of the config
!openvpn
*.* /var/log/openvpn.log
buat file openvpn.log dan restart syslog
#touch /var/log/openvpn.log
#killall -HUP syslogd
11. buat file script up.sh dan down.sh
/usr/local/etc/openvpn/up.sh
isinya :
#!/bin/sh
/sbin/ifconfig bridge0 create
/sbin/ifconfig bridge0 addm vr0 addm $dev up
/sbin/ifconfig $dev up
/sbin/ifconfig bridge0 inet 10.1.0.50 netmask 255.255.255.0
/usr/local/etc/openvpn/down.sh
isinya :
#!/bin/sh
/sbin/ifconfig bridge0 deletem $dev
/sbin/ifconfig bridge0 destroy
/sbin/ifconfig $dev destroy
jadikan kedua file sh tersebut executable
12. bikin user untuk login ke openvpn
#adduser client1
13. Jalankan daemon openvpn
# /usr/local/etc/rc.d/openvpn start
Incoming search terms:
- freebsd openvpn with user password 2011
- how to install openvpn di freebsd
- openvpn on freebsd 8
- membuat openvpn dengan free bsd
- openvpn pf freebsd
- openvpn server at bsd
- security untuk membangun openvpn
- user openvpn server di freebsd
No comments yet.