Rully's Blog

05 April 2007

WPA di GNU/Linux Debian

Assalamu'alaikum Warahmatullahi Wabarakatuh


Nyoba WPA di Sid, susah-susah gampang. Kurang lebih gini lah:

1. Cari dulu
:~# apt-cache search wpa
wpasupplicant - Client support for WPA and WPA2 (IEEE 802.11i)

2. Install
:~# apt-get install wpasupplicant

3. Copy contoh file konfigurasi
:~# cp /usr/share/doc/wpasupplicant/examples/wpa_supplicant.conf.template /etc/wpa_supplicant.conf

4. Edit file konfigurasi
:~# vim /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="SSID-nya"
psk="KEY-nya"
key_mgmt=WPA-PSK
}

5. Coba ah ...
~# wpa_supplicant -ieth1 -Dipw -B -c/etc/wpa_supplicant.conf
ioctl[IPW_IOCTL_WPA_SUPPLICANT]: Operation not supported
Failed to set encryption.

Walah, gagal. Gugling. Wah, ipw gak support. Ganti sama wext.

6. Coba ganti driver
:~# wpa_supplicant -ieth1 -Dwext -B -c/etc/wpa_supplicant.conf
Berhasil. Tapi belum dapet IP nih dari dhcp server. Tanya ke yang lain, dikasih tau sama pak Budi.

7. Jalanin dhcp client.
:~# dhclient
Berhasil dapet IP & connect ke Internet.

8. Baca dulu.
:~# less /usr/share/doc/wpasupplicant/README.Debian

9. Copy file daemon-nya.
:~# cp /usr/share/doc/wpasupplicant/examples/wpa_supplicant.init-daemon /etc/init.d/wparoamd

10. Buat jadi executable.
:~# chmod +x /etc/init.d/wparoamd

11. Edit sesuai kebutuhan.
:~# vim /etc/init.d/wparoamd
CONFIG="/etc/wpa_supplicant.conf"
INTERFACE="eth1"
DRIVER="wext"

12. :~# update-rc.d wparoamd start 15 2 3 4 5 . stop 90 0 1 6 .
:~# invoke-rc.d wparoamd start


13. Expand dulu, terus baca.
:~# gunzip /usr/share/doc/wpasupplicant/README.modes.gz
:~# less /usr/share/doc/wpasupplicant/README.modes


14. Set interfaces seperlunya.
:~# vim /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf

15. :~# /etc/init.d/networking stop
:~# /etc/init.d/networking start


Beres.


Wassalamu'alaikum Warahmatullahi Wabarakatuh

04 April 2007

E: Sub-process /usr/bin/dpkg return an error code (1)

Assalamu'alaikum Warahmatullahi Wabarakatuh


Udah lama gak update blog ini. Error ini muncul udah lama. Intinya sih karena rubah sources.list, update & dist-upgrade, font jadi ngaco & terakhir ... KDE gak jalan. He he. Tapi sekarang udah ok lagi. Kurang lebih kayak gini lah:

1. Rubah sources.list kembali ke semula.
:~# vim /etc/apt/sources.list
deb http://mirrors.kernel.org/debian/ sid main
deb-src http://mirrors.kernel.org/debian/ sid main


2. :~# apt-get update && apt-get dist-upgrade -f
Soalnya kalo gak pake option -f, gak bisa terus.

3. Nah disini muncul error. Gak beres-beres dist-upgrade-nya.
dpkg: error processing /var/cache/apt/archives/x11-common_1%3a7.1.0-15_i386.deb (--unpack):
trying to overwrite '/usr/X11R6/bin', which also in package nessusclient
Errors were encountered while processing:
/var/cache/apt/archives/x11-common_1%3a7.1.0-15_i386.deb
E: Sub-process /usr/bin/dpkg return an error code (1)


4. Pas kebetulan tanya ke pak Andika, terus dijelasin. Dicoba & berhasil.
:~# dpkg -i --force overwrite /var/cache/apt/archives/x11-common_1%3a7.1.0-15_i386.deb

5. Lanjutin lagi.
:~# apt-get dist-upgrade -f

6. KDE & font yang rusak, ok lagi. Gak bisa login langsung root. Ya bisa liat posting sebelumnya di blog ini. Masih banyak yang belum dicek. Nanti aja lah.
:~# apt-get update && apt-get upgrade

Beres.


Wassalamu'alaikum Warahmatullahi Wabarakatuh

09 December 2006

Upgrade Cacti

Assalamu'alaikum Warahmatullahi Wabarakatuh


Coba upgrade cacti di notebook.

1. :~# apt-get install cacti

2. :~# adduser cacti

3. :~# mysql --user=root mysql

4. mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';

5. mysql> flush privileges;

6. mysql> exit

7. Edit file debian.php

:~# vim /etc/cacti/debian.php

$database_username='cacti';
$database_password='cacti';
$database_default='cacti';
$database_hostname='localhost';
$dbport='';
$dbtype='mysql';
?>


8. Browse ke: http://localhost/cacti/

- Next
- Please select the type of installation: Upgrade from cacti 0.8.x
- Next
- Upgrade results:
0.8.6f -> 0.8.6g
[Success] ALTER TABLE `host_snmp_cache` CHANGE `snmp_index` `snmp_index` VARCHAR( 255 ) NOT NULL;
[Success] ALTER TABLE `data_local` CHANGE `snmp_index` `snmp_index` VARCHAR( 255 ) NOT NULL;
[Success] ALTER TABLE `graph_local` CHANGE `snmp_index` `snmp_index` VARCHAR( 255 ) NOT NULL;
[Success] ALTER TABLE `graph_templates_graph` CHANGE `lower_limit` `lower_limit` VARCHAR ( 20 ) DEFAULT '0';
[Success] ALTER TABLE `graph_templates_graph` CHANGE `upper_limit` `upper_limit` VARCHAR ( 20 ) DEFAULT '0';
0.8.6g -> 0.8.6h
[Success] ALTER TABLE `host` MODIFY COLUMN `min_time` DECIMAL(10,5) DEFAULT 9.99999;
[Success] ALTER TABLE `host` MODIFY COLUMN `max_time` DECIMAL(10,5) DEFAULT 0.00000;
[Success] ALTER TABLE `host` MODIFY COLUMN `cur_time` DECIMAL(10,5) DEFAULT 0.00000;
[Success] ALTER TABLE `host` MODIFY COLUMN `avg_time` DECIMAL(10,5) DEFAULT 0.00000;
[Success] ALTER TABLE `user_log` MODIFY COLUMN `ip` VARCHAR(40);
[Success] UPDATE graph_templates_item SET text_format = '' WHERE local_graph_id <> 0 AND color_id = 0 AND graph_type_id IN(4,5,6,7,8) AND text_format <> '';
- Next
- Make sure all of these values are correct before continuing.
[FOUND] RRDTool Binary Path: The path to the rrdtool binary. -> /usr/bin/rrdtool
[FOUND] PHP Binary Path: The path to your PHP binary file (may require a php recompile to get this file). -> /usr/bin/php
[FOUND] snmpwalk Binary Path: The path to your snmpwalk binary. -> /usr/bin/snmpwalk
[FOUND] snmpget Binary Path: The path to your snmpget binary. -> /usr/bin/snmpget
[FOUND] snmpbulkwalk Binary Path: The path to your snmpbulkwalk binary. -> /usr/bin/snmpbulkwalk
[FOUND] snmpgetnext Binary Path: The path to your snmpgetnext binary. -> /usr/bin/snmpgetnext
[FOUND] Cacti Log File Path: The path to your Cacti log file. -> /usr/share/cacti/site/log/cacti.log
SNMP Utility Version: The type of SNMP you have installed. Required if you are using SNMP v2c or don't have embedded SNMP support in PHP. -> NET_SNMP 5.X
RRDTool Utility Version: The version of RRDTool that you have installed. -> RRDTool 1.2.x

- Finish


9. Login

Please enter your Cacti user name and password below:

User Name:

Password:


*waduh, lupa login yang lama*

10. Reset login

:~# mysql -u root cacti

mysql> update user_auth set password=md5('admin') where username='admin';

Query OK, 1 row affected (0.08 sec)

Rows matched: 1 Changed: 1 Warnings: 0


11. Browse ke: http://localhost/cacti/

12. Login

Please enter your Cacti user name and password below:

User Name: admin

Password: admin


13. Selesai


Wassalamu'alaikum Warahmatullahi Wabarakatuh

02 November 2006

Cacti II

Assalamu'alaikum Warahmatullahi Wabarakatuh


Buat semua pengunjung blog ini dan yang ini, Selamat Idul Fitri 1 Syawal 1427 H. Taqabalallahu minna wa minkum, mohon maaf lahir & batin.
Beberapa minggu yang lalu, coba (lagi) install cacti di mesin yang lain (router). Sebelumnya install di notebook. Hm ... ada sedikit perbedaan.
Intinya sih sama. Cuma ada "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)".

1. Install Cacti & DAMP (Debian, Apache, MySQL, PHP). *He he*

:~# apt-get install cacti

2. :~# adduser cacti

3. :~# mysqld --skip-grant-tables --user=root

4. :~# mysql -u root

5. mysql> UPDATE mysql.user SET Password=PASSWORD('password_baru') WHERE User='root';

Query OK, 2 rows affected (0.07 sec)
Rows matched: 2 Changed: 2 Warnings: 0


6. mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.07 sec)

7. mysql> exit

8. :~# vim /etc/cacti/debian.php

$database_username='cacti';
$database_password='cacti';
$database_default='cacti';
$database_hostname='localhost';
$dbport='';
$dbtype='mysql';


9. :/usr/share/cacti/site# chown -R cacti rra/ log/

10. Tambahkan 1 baris di file crontab:

:~# vim /etc/crontab

*/5 * * * * cacti php /usr/share/cacti/site/poller.php > /dev/null 2>&1

11. :~# mysql --user=root mysql -p

12. mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti';

13. mysql> flush privileges;

14. mysql> exit

15. Browse ke: http://ip-router/cacti/

Error

You have created a new database, but have not yet imported the 'cacti.sql' file. At the command line, execute the following to continue:

mysql -u cacti -p cacti < cacti.sql

This error may also be generated if the cacti database user does not have correct permissions on the cacti database. Please ensure that the cacti database user has the ability to SELECT, INSERT, DELETE, UPDATE, CREATE, ALTER, DROP, INDEX on the cacti database.


*waduh, ada yang lupa*

16. :~# mysqladmin --user=root create cacti -p

17. :~# zcat /usr/share/doc/cacti/cacti.sql.gz | mysql -u cacti --password=cacti cacti

18. :~# echo "extension=mysql.so" >> /etc/php4/apache/php.ini

19. :~# /etc/init.d/apache restart

20. Browse (lagi) ke: http://ip-router/cacti/. Berhasil.

- Next
- Please select the type of installation: New Install
- The following information has been determined from Cacti's configuration file. If it is not correct, please edit 'include/config.php' before continuing.
Database User: cacti
Database Hostname: localhost
Database: cacti
Server Operating System Type: unix
- Next
- Make sure all of these values are correct before continuing.
[FOUND] RRDTool Binary Path: The path to the rrdtool binary. -> /usr/bin/rrdtool
[FOUND] PHP Binary Path: The path to your PHP binary file (may require a php recompile to get this file). -> /usr/bin/php
[FOUND] snmpwalk Binary Path: The path to your snmpwalk binary. -> /usr/bin/snmpwalk
[FOUND] snmpget Binary Path: The path to your snmpget binary. -> /usr/bin/snmpget
[FOUND] snmpbulkwalk Binary Path: The path to your snmpbulkwalk binary. -> /usr/bin/snmpbulkwalk
[FOUND] snmpgetnext Binary Path: The path to your snmpgetnext binary. -> /usr/bin/snmpgetnext
[FOUND] Cacti Log File Path: The path to your Cacti log file. -> /usr/share/cacti/site/log/cacti.log
SNMP Utility Version: The type of SNMP you have installed. Required if you are using SNMP v2c or don't have embedded SNMP support in PHP. -> NET_SNMP 5.X
RRDTool Utility Version: The version of RRDTool that you have installed. -> RRDTool 1.2.x

- Finish


21. Login

Please enter your Cacti user name and password below:
User Name:
admin
Password: admin

22. *** Forced Password Change ***

Please enter a new password for cacti:
Password:
Confirm:


23. Selesai


Wassalamu'alaikum Warahmatullahi Wabarakatuh

21 October 2006

Router

Assalamu'alaikum Warahmatullahi Wabarakatuh


Udah lama gak update blog ini. Blog lain juga udah lama gak di-update sih. Coba setup router. Langkah-langkahnya:

1. Edit hostname
:~# vim /etc/hostname

router-server

2. Edit/tambahkan hosts
:~# vim /etc/hosts

127.0.0.1 localhost.localdomain localhost router-server.perusahaan.co.id router-server

3. Edit resolv.conf
:~# vim /etc/resolv.conf

search

nameserver 202.XXX.XXX.2
nameserver 202.XXX.XXX.4

4. Edit interfaces
:~# vim /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 202.XXX.XXX.12
netmask 255.255.255.192
gateway 202.XXX.XXX.1

auto eth1
iface eth1 inet static
address 202.XXX.XXX.249
netmask 255.255.255.248

auto eth1:1
iface eth1:1 inet static
address 192.168.0.254
netmask 255.255.255.0

5. Buat script iptables, disesuaikan dengan kebutuhan. Contoh:
:~# vim /etc/init.d/rc.firewall

#!/bin/sh

wan="202.XXX.XXX.12"
lan="192.168.0.0/24"
office="202.XXX.XXX.192/26"
ns2="202.XXX.XXX.4"
ohle="202.XXX.XXX.9/32"

echo "1" > /proc/sys/net/ipv4/ip_forward

iptables --flush
iptables -t nat --flush
iptables -t mangle --flush

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -t nat -A POSTROUTING -s $lan -d ! $lan -j SNAT --to $wan

iptables -t nat -I PREROUTING -p tcp -i eth0 -s ! $office --dport 8080 -j DNAT --to 192.168.0.1:8080

6. :~# update-rc.d rc.firewall defaults


Wassalamu'alaikum Warahmatullahi Wabarakatuh

23 March 2006

E: Sub-process /usr/bin/dpkg received a segmentation fault

Assalamu'alaikum Warahmatullahi Wabarakatuh


Pas mau install knockd (apt-get install knockd), eh ... gak bisa & muncul E: Sub-process /usr/bin/dpkg received a segmentation fault.

Googling, ketemu solusinya:

1. :/var/cache/apt/archives# ar x knockd_0.4-1_i386.deb

2. :/var/cache/apt/archives# cd / && tar -zxvf /var/cache/apt/archives/data.tar.gz

Beres.


Wassalamu'alaikum Warahmatullahi Wabarakatuh

10 March 2006

Update Driver "Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)"

Assalamu'alaikum Warahmatullahi Wabarakatuh

Coba update driver ipw2200. Gagal terus berkali-kali. Dan akhirnya, berhasil juga. Langkah-langkahnya:

1. :/usr/src# tar -xvvzf ieee80211-1.1.12.tgz

2. :/usr/src/ieee80211-1.1.12# . remove-old

3. :/usr/src/ieee80211-1.1.12# for i in ieee80211 ipw2200; do find /lib/modules/`uname -r` -iname ${i}*; done

4. :/lib/modules/2.6.15.1Y/build/include/linux# vim autoconf.h

hapus: /*#undef CONFIG_IEEE80211*/

5. :/lib/modules/2.6.15.1Y/build/include/linux# vim ../../.config

hapus: # CONFIG_IEEE80211 is not set

6. :/lib/modules/2.6.15.1Y/kernel/drivers/net/wireless# rm ipw2200.ko

7. :/usr/src/ieee80211-1.1.12# make

8. :/usr/src/ieee80211-1.1.12# make IEEE80211_INC=/usr/include

9. :/usr/src/ieee80211-1.1.12# make install IEEE80211_INC=/usr/include

10. :/usr/src# tar -xvvzf ipw2200-1.1.1.tgz

11. :/usr/src/ipw2200-1.1.1# . remove-old

12. :/usr/src/ipw2200-1.1.1# make IEEE80211_INC=/usr/src/ieee80211-1.1.12/

13. :/usr/src/ipw2200-1.1.1# make install IEEE80211_INC=/usr/src/ieee80211-1.1.12/

14. :/usr/lib/hotplug/firmware# tar -xvvzf ipw2200-fw-3.0.tgz

15. :/usr/lib/hotplug/firmware# mv ipw2200-fw-3.0/*.* .

16. :/usr/src/ipw2200-1.1.1# modprobe ipw2200

17. :/usr/src/ipw2200-1.1.1# . load

18. /usr/src/ipw2200-1.1.1# iwconfig

19. Edit file interfaces
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp

wireless-essid
COBA
wireless-key s:diisi WEP key nya

20. Restart networking
:~# /etc/init.d/networking stop
:~# /etc/init.d/networking start


21. Terhubung ke Access Point.

Wassalamu'alaikum Warahmatullahi Wabarakatuh