Friday, June 13, 2008

Membuat Gateway Flash Telkomsel di Ubuntu Linux

Dari pada pusing riset lagi dari awal, mendingan bikin dokumentasinya dan berbagi kemudahan ini ke orang banyak. Saya akan menjelaskan bagaimana membuat Ubuntu Linux kita menjadi server gateway internet dengan menggunakan Huawei modem dari Flash Telkomsel.

Cara ini berhasil di Ubuntu 8.04 karena paket wvdial yang dimilikinya mampu menkonfigurasi otomatis huawei modem. Untuk berbagi ke jaringan, pastikan koneksi komputer kita dengan komputer2 lainnya di LAN berjalan baik.

Deteksi Modem
  1. Pastikan pulsanya Telkomsel Flash ada
  2. Tancap kabel yang tengah (baca keterangan pada usb jack!). Karena ada 2 jack yang punya fungsi berbeda.
  3. Pastikan Ubuntu dapat mendeteksi modem pasca penancapan usb. Biasanya baru sempurna deteksinya setelah 1 menit. Cek dengan lsusb. Harusnya ada tulisan kira2 seperti ini:
Bus 005 Device 005: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem

Konfigurasi dan dialing
  1. Lakukan konfigurasi otomatis "sudo wvdialconf". Perintah ini harusnya menghasilkan file /etc/wvdial.conf yang berisi kira2 seperti berikut ini. Pastikan bahwa hasil konfigurasi otomatis ini menghasilkan nilai "Username" dan "Password" seperti di bawah ini, yakni { }
    [Dialer Defaults]
    Init1 = ATZ
    Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    Modem Type = Analog Modem
    ISDN = 0
    New PPPD = yes
    Phone = *99#
    Modem = /dev/ttyUSB0
    Username = { }
    Password = { }
    Baud = 9600

  2. Lakukan dial dan biarkan jaringan Ubuntu dikonfigurasi oleh wvdial
    sudo wvdial

    Harusnya dalam waktu singkat wvdial akan mengeluarkan input akhir seperti ini:

    --> local IP address
    --> pppd: 3[7f]
    --> remote IP address
    --> pppd: 3[7f]
    --> primary DNS address
    --> pppd: 3[7f]
    --> secondary DNS address
    --> pppd: 3[7f]

    Selain itu akan tampak perubahan pada perintah "sudo route" * UH 0 0 0 ppp0 * U 0 0 0 eth0
    default * U 0 0 0 ppp0

    dan bergantinya dns pada /etc/resolv.conf sebagai berikut


  3. Pastikan kita bisa browsing di Ubuntu kita.
    Buka browser kesayangan kita dan buka sebuah situs. Kita diharuskan mengisi login ke Flash Telkomsel. Buka halaman kedua yang digunakan untuk menjelajah internet. Jika kita berhasil membuka sebuah situs, berarti kita siap melangkah lebih jauh.

Menjadikan Ubuntu sebagai gateway untuk internet di LAN.
  1. Ganti gateway komputer2 satelit. Arahkan gateway komputer2 yang ada di LAN ke ip LAN milik Ubuntu. Jika Ubuntu kita memiliki ip jaringan lokal, maka pastikan gateway komputer2 yang akan ikutan pakai internet adalah juga.
  2. Ganti DNS komputer2 satelit. Pastikan dns komputer2 tersebut diarahkan ke 2 dns yang dideteksi oleh wvdial di atas. Sehingga pada salah satu komputer2 satelit tersebut, perintah "sudo route" akan mengasilkan:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface * U 0 0 0 eth0
    default UG 100 0 0 eth0
  3. Izinkan akses langsung internet oleh komputer satelit
    Pada Ubuntu yang kini telah menjadi gateway, jalankan perintah berikut (sesuaikan nilai device output, apakah ppp0 atau ppp1 atau lainnya. Ini tergantung apa yang terlihat dari default gateway hasil perintah "sudo route")

    sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
    echo 1 > /proc/sys/net/ipv4/ip_forward

Semoga berhasil

Tuesday, June 10, 2008

Typing Arabic with Scim

Alhamdulillah and thanks to Anjar03 my friend who has been researching and being curios with Scim and the author of the code (yes, the one who has created scim Arabic). I finally can write Arabic with Scim in Kubuntu, KDE version of Ubuntu. I want to document it here so everybody can leverage Scim as I do.

Please make sure you've installed the following packages so that KDE will automatically use Scim as default input method: scim-bridge-agent scim-bridge-client-qt scim-bridge-client-gtk. For KDE4 may be you should install additional scim-bridge-client-qt4. After that, type "im-switch -s scim-bridge" to activate Scim. For more information see my previous post and here.

To type Arabic you don't need scim-anthy since it is for Japanese. You need scim-tables-additional package installed. Now, re-login.

To test, open kopete chat window since it automatically supports right to left typing mode. Ctrl+Space to start writing with Scim, choose Arabic Egypt from the scim popup. You should see Scim popup like the following

Adapted from this table, we can use the following rule using US Keyboard (the most common keyboard at least in my country: Indonesia).

arabic fontkeyboard

- To type لا you can combine A and l.
- The words انّ with tashdid is typed Anx.
- To make vowel, just add a i u after the consonant.
- To make tanwin, just add an in un after the consonant.

الحمداللّه now you can type Arabic

Minbar crash on non Gnome Ubuntu derivatives?

I'm currently using Kubuntu 8.04 amd64. I installed Minbar to remind me of prayer time. It worked fine except, it crashed when I tried to play athan.

I've been searching to solve this problem. I even downloaded its source code to see what happen. From it, I concluded that there must be related to audio plugin. After gooling a little bit, I think the author forgot to include some Gstreamer library as one of Minbar's dependencies since he never used other than Ubuntu. May be, ubuntu has already has that dependency. But not with Kubuntu or Xubuntu.

The solution is just install the following packages: gstreamer0.10-plugins-base, gstreamer0.10-plugins-good
That should solve your problem and make sure you to always pray on time :D

Monday, June 9, 2008

Drupal 5 Performance Tuning, Suprising way

Lately, I tried to tuning up my Drupal 5-based website for one of my company's clients. And successfully achieve their requested test: more than 50 requests per seconds with only one additional PHP PECL module: APC. Alhamdulillah, finally. It was achieved by an unusual way, at least for me.

About 2 months before during development time, I had the Drupal pass the same test. This fact made me relieved that the development is on the track. But at the time, it did not load so much modules as it did lately. To, make it faster, I even activated memcache and advanced session modules. Then, I continued to add and customize additional modules. I think, without testing it anymore.

Two months later, I found out that my Drupal had gone slow. It could only handle no more than 25 requests per seconds. What?..... This made me curious over the new modules. I tried to turn they off one by one and I fired up xcache to see what was happening. After tuning up Apache2, MySQL, and others I could just only rise 2 more request.

I felt something must had gone wrong but not in the Drupal. Because fresh Drupal at the same time also never reached 50 requests per seconds but it had actually before (2 months before). What about removing just (since 2 months before) installed PHP memcache.ini and xcache.ini or renaming it, so that PHP assumes that there is no memcache and xcache.ini

Wonderfully and suprisingly, my Drupal passed the test and reached 52 requests per second. This made me think, sometimes we don't need to go far away to find solutions. The solutions may be near us.