Subscribe:

Ads 468x60px

Senin, 13 Juni 2011

Mikrotik Load Balance


Load Balance with Mikrotik


IP Addresses

/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LAN
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=ISP1
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=ISP2

The router has two ISP interfaces with the addresses of 10.111.0.2/24 and 10.112.0.2/24. The LAN interface has IP address of 192.168.0.1/24.

Policy routing

/ ip firewall mangle
add chain=prerouting dst-address=10.111.0.0/24 action=accept in-interface=LAN
add chain=prerouting dst-address=10.112.0.0/24 action=accept in-interface=LAN

With policy routing it is possible to force all traffic to the specific gateway, even if traffic is destined to the host (other that gateway) from the connected networks. This way routing loop will be generated and communications with those hosts will be impossible. To avoid this situation we need to allow usage of default routing table for traffic to connected networks.

add chain=prerouting in-interface=ISP1 connection-mark=no-mark action=mark-connection \
new-connection-mark=ISP1_conn
add chain=prerouting in-interface=ISP2 connection-mark=no-mark action=mark-connection \
new-connection-mark=ISP2_conn

First it is necessary to manage connection initiated from outside - replies must leave via same interface (from same Public IP) request came. We will mark all new incoming connections, to remember what was the interface.


add chain=prerouting in-interface=LAN connection-mark=no-mark dst-address-type=!local \
per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=LAN connection-mark=no-mark dst-address-type=!local \
per-connection-classifier=both-addresses:2/1 action=mark-connection new-connection-mark=ISP2_conn

Action mark-routing can be used only in mangle chain output and prerouting, but mangle chain prerouting is capturing all traffic that is going to the router itself. To avoid this we will use dst-address-type=!local. And with the help of the new PCC we will divide traffic into two groups based on source and destination addressees.

add chain=prerouting connection-mark=ISP1_conn in-interface=LAN action=mark-routing \
new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=LAN action=mark-routing \
new-routing-mark=to_ISP2
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2

Then we need to mark all packets from those connections with a proper mark. As policy routing is required only for traffic going to the Internet, do not forget to specify in-interface option.

/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=to_ISP1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=to_ISP2 check-gateway=ping

Create a route for each routing-mark

add dst-address=0.0.0.0/0 gateway=10.111.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 distance=2 check-gateway=ping

To enable failover, it is necessary to have routes that will jump in as soon as others will become inactive on gateway failure. (and that will happen only if check-gateway option is active)
NAT

/ ip firewall nat
add chain=srcnat out-interface=ISP1 action=masquerade
add chain=srcnat out-interface=ISP2 action=masquerade

As routing decision is already made we just need rules that will fix src-addresses for all outgoing packets. If this packet will leave via wlan1 it will be NATed to 10.112.0.2, if via wlan2 then NATed to 10.111.0.2

source http://wiki.mikrotik.com/wiki/Manual:PCC Baca selengkapnya

Senin, 16 Mei 2011

Ebook Programming dan database


This is my collection Ajax, PHP, Mysql, SQL server from best publisher like Sams Publihing, O'reilly, Apress, Prentice Hall, For dummies, Microsoft and more, it will be continuosly update:
Baca selengkapnya

Solusi Hotspot dengan Mikrotik


Diasumsikan Mikrotik telah terkonfigurasi dengan baik dan tersambung ke internet, panduan ini menitik beratkan pada konfigurasi hotspot nya saja.

ikuti langkah dibawah ini :
selanjutnya input ip lokal untuk hotspotnya, biasanya akan mengikuti ip interface wirelesess yang pernah kita set sebelumnya

lanjutkan dengan miilih pool untuk hotspot
selanjutnya konfigurasi smtp
setelah itu isi DNS untuk hotspot anda
dan isi dns name nya
lanjutkan mengisi user name dan password untuk admin hotspot
langkah terakhir adalah membuat list user yang diperbolehkan mengakses hotspot
untuk autentikasi user dapat kita integrasikan dengan radius server, pada Mikrotik radius server menggunakan user manager yang akan dibahas selanjutnya yaitu topik Hotspot dan user manager.
silahkan di coba membuka website, koneksikan terlebih dahulu notebook ke AP yang telah terkonfigurasi dengan Mikrotik.
Untuk melihat siapa saja yang sedang menggunakan mikrotik bisa dilihat di
Semoga membantu


Baca selengkapnya

Minggu, 15 Mei 2011

Replikasi OpenLdap dengan konsep Master Slave



Pada artikel ini, akan dijelaskan teknik replikasi data OpenLdap dengan menggunakan konsep master-slave.

Untuk menyediakan redundancy data agar tingkat ketersediaan data tinggi, maka mekanisme replikasi data menjadi penting, tidak terkecuali data atau informasi dalam database direktori LDAP. Untuk itu OpenLdap menyediakan fitur replikasi direktori LDAP yang dapat anda konfigurasi dengan mudah.

Disini saya menggunakan CentOS 5.3, diasumsikan seluruh paket OpenLdap telah terinstall pada masing-masing server baik LDAP master maupun LDAP slave, Paket OpenLdap yang terinstall pada masing-masing server merupakan paket bawaan distro CentOS 5.3. Jika pada kedua server belum terinstall OpenLdap, anda dapat dengan mudah melakukan instalasi menggunakan 'yum' dengan perintah yum install OpenLdap

Diasumsikan OpenLdap master 192.168.1.10 dan slave 192.168.1.20.

OpenLdap
OpenLdap adalah software open source yang mengimplementasikan protokol LDAP yang tersedia secara gratis dan terbuka. Umumnya banyak distro linux telah menyertakan OpenLdap dalam distribusi mereka.

Paket-Paket software OpenLdap terdiri dari beberapa library tool berikut :

1. OpenLdap berisi library-library yang diperlukan untuk menjalankan aplikasi OpenLdap server dan aplikasi client.
2. OpenLdap-client berisi tool dalam bentuk perintah command line untuk menampilkan dan memodifikasi direktori data suat LDAP server.
3. OpenLdap-Servers berisi aplikasi server dan utiliti lain mengkonfigurasi dan manjalankan LDAP-server.

Konfigurasi awal pada OpenLdap server (Master dan Slave)

konfigurasi awal OpenLdap master dan slave dengan cara mengedit file /etc/openldap/slapd.conf, ada beberapa parameter konfigurasi yang perlu diatur agar sesuai dengan skenario anda pada OpenLdap master dan slave.

database bdb
suffix "dc=myldap,dc=com"
rootdn "cn=admin,dc=myldap",dc=com"
rootpw secret

Setelah melakukan konfigurasi OpenLdap server (master dan slave), lanjutkan dengan menjalankan perintah berikut ini :

Pada OpenLdap master :
[root@master]# service ldap start

Pada OpenLdap slave :
[root@slave]# service ldap start

Menambahkan entri data ke direktori LDAP master

Berikutnya menambahkan entri data ke direktori LDAP. Untuk itu anda buat dahulu file ldif (namafile : data.ldif) dengan cara :

[root@master]# vi data.ldif

lalu isi dengan data berikut ini :

dn: dc=myldap,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
dc: myldap
o: PT. Eterna computer

dn: ou=it,dc=myldap,dc=com
objectClass: organizationalUnit
objectClass: top
ou: it

dn: ou=hrd,dc=myldap,dc=com
objectClass: organizationalUnit
objectClass: top
ou: hrd

dn: cn=andi,ou=it,dc-myldap,dc=com
objectClass: inetOrgPerson
cn: andi
sn: Andi Akbar
homephoen: 62-21-8934580
mail: andi@myldap.com

dn: cn=karel,ou=hrd,dc-myldap,dc=com
objectClass: inetOrgPerson
cn: karel
sn: Karel Akbar
homephoen: 62-21-8934580
mail: andi@myldap.com

Selanjutnya data ldif yang sudah dibuat kita tambahkan kedalam database direktori LDAP master dengan cara :

[root@master]# ldapadd -x -D "cn=admin,dc=myldap,dc=com" -f data.ldif -W

bila muncul pesan error coba cek lagi penulisan data ldif nya.

Sampai disini kita telah berhasil meng-entri data kedalam database direktori LDAP master, untuk membuktikan LDAp master telah berisi data yang kita input tadi dengan perintah berikut :

[root@master]# ldapsearch -x -b"dc=myldap,dc=com"

Konfigurasi replikasi pada LDAP master

Disisi master anda perlu mengedit file /etc/openldap/slapd.conf tambahkan konfigurasi replikasi pada baris akhir sebagai berikut :

replogfile /var/lib/ldap/openldap-master-replog
replica host=192.168.1.20:389
suffix="dc=myldap,dc=com"
binddn="cn=admin,dc=myldap,dc=com"
credentials = secret
bindmethod = simple
tls = no

Direktif replica menunjukan host, suffix dan binddn dari LDAP slave. dengan adanya konfigurasi replikasi ini maka ketika anda merestart service LDAP maka akan ada 2 buah daemon yang jalan yaitu slapd dan slurpd. Slurpd berperan sebagai daemon untuk replikasi ke server LDAP slave.

Selanjutnya, lakukan backup keseluruhan database direktori LDAP master yang ada pada saat ini dengan perintah :

[root@master]# ldapsearch -x -b "dc=myldap,dc=com" > contents.ldif

atau

[root@master]# slapcat -b "dc=myldap,dc=com" -l contents.ldif

Test transfer file contents.ldif ke server LDAP slave. Lalu matikan dulu service LDAP pada master sampai selesai mengkonfigurasi slave.

Konfigurasi replikasi pada LDAP slave

Pada sisi slave anda perlu mengedit file /etc/openldap/slapd.conf dengan menambahkan konfigurasi dibawah ini pada baris akhir sebagai berikut :

###updatedn adalah dn yang ada pada server LDAP slave
updatedn "cn=admin,dc=myldap,dc=com"
###asumsi ip address server master 192.168.1.10
updateref ldap://192.168.1.10

Selanjutnya, aktifkan server LDAP slave dan import dahulu hasil backup contents.ldif master ke slave (untuk menyamakan data awal pada master dan slave sebelum diaktifkan replikasi) dengan cara berikut :

[root@slave]# ldapadd -x -D "cn=admin,dc=myldap,dc=com" -f contents.ldif -W

aktifkan atau restart server LDAp master lalu cobalah menambahkan data pada master (format penulisan ikuti data.ldif yang pernah dibuat sebelumnya) lalu lihat beberapa saat kemudian pada slave apakah sama dengan yang ada pada master, gunakan perintah :

ldapsearch -x -b "dc=myldap,dc=com"

jika sama maka replikasi telah berjalan dengan baik !
Baca selengkapnya

Mempercepat proses startup Windows XP


Anda hanya perlu memanfaatkan program registry editor dari Windows XP, pertama anda harus membuka program registry editor dengan mengetikkan regedit dari menu "Start | Run
kemuadian setelah program registry editor munculmasuklah ke entry "HKEY_CURRENT_USER | CONTROL Panel | Desktop". Setelah itu arahkan mouse pada jendela kanan, klik 2x pada bagian "MenuShowDelay", ganti nilai "value data" dengan angka "0"
.Klik OK lalu tutup Registry editor dan restart komputer anda, pada proses startup berikutnya startup terasa akan lebih cepat. Baca selengkapnya

Advertise