Friday, February 15, 2008 15:28:02

GPRS Internet via Bluetooth di Linux

Article and tutorial that related to Linux Operating System  
Saat - saat ini internet semakin murah, dengan beragam ISP, Operator Selular dan pihak lain yang menawarkan beragam koneksi yang makin mudah dan cepat. Pada artikel kali ini dicoba mengakses internet menggunakan media bluetooth ke PC Linux, karena penulis tidak membeli kabel data untuk HP Sony Ericsson P990i yang dimiliki.
Distro yang dipergunakan adalah Debian dengan bluez-utils 3.7-1. Yang pertama - tama dilakukan adalah mencolokkan alat bluetooth ke PC kita.

Ketika dicolokkan akan muncul tampilan kurang lebih seperti hal berikut:
Feb 14 03:20:40 localhost kernel: usb 1-1: new full speed USB device using uhci_hcd and address 18
Feb 14 03:20:40 localhost kernel: usb 1-1: configuration #1 chosen from 1 choice
Feb 14 03:20:40 localhost kernel: hub 1-1:1.0: USB hub found
Feb 14 03:20:40 localhost kernel: hub 1-1:1.0: 3 ports detected
Feb 14 03:20:40 localhost kernel: usb 1-1.1: new full speed USB device using uhci_hcd and address 19Feb 14 03:20:40 localhost kernel: usb 1-1.1: configuration #1 chosen from 1 choice
Feb 14 03:20:40 localhost kernel: usb 1-1.2: new full speed USB device using uhci_hcd and address 20Feb 14 03:20:41 localhost kernel: usb 1-1.2: configuration #1 chosen from 1 choice
Feb 14 03:20:41 localhost kernel: input: HID 0a5c:4502 as /class/input/input7
Feb 14 03:20:41 localhost kernel: input: USB HID v1.11 Keyboard [HID 0a5c:4502] on usb-0000:00:07.2-1.2
Feb 14 03:20:41 localhost kernel: usb 1-1.3: new full speed USB device using uhci_hcd and address 21Feb 14 03:20:41 localhost kernel: usb 1-1.3: configuration #1 chosen from 1 choice
Feb 14 03:20:41 localhost kernel: input: HID 0a5c:4503 as /class/input/input8
Feb 14 03:20:41 localhost kernel: input: USB HID v1.11 Mouse [HID 0a5c:4503] on usb-0000:00:07.2-1.3

Kemudian kita harus melakukan setting agar piranti bluetooth berjalan dengan baik (/etc/bluetooth/hcid.conf)
#
# HCI daemon configuration file.
#

# HCId options
options {
  # Automatically initialize new devices
  autoinit yes;

  # Security Manager mode
  #   none - Security manager disabled
  #   auto - Use local PIN for incoming connections
  #   user - Always ask user for a PIN
  #
  security auto;

  # Pairing mode
  #   none  - Pairing disabled
  #   multi - Allow pairing with already paired devices
  #   once  - Pair once and deny successive attempts
  #pairing multi;

  # Default PIN code for incoming connections
  #passkey "1234";
}

# Default settings for HCI devices
device {
  # Local device name
  #   %d - device id
  #   %h - host name
  name "SERVER";

  # Local device class
  #class 0x3e0100;

  # Default packet type
  #pkt_type DH1,DM1,HV1;

  # Inquiry and Page scan
  iscan enable; pscan enable;

  # Default link mode
  #   none   - no specific policy
  #   accept - always accept incoming connections
  #   master - become master on incoming connections,
  #            deny role switch on outgoing connections
  lm accept;

  # Default link policy
  #   none    - no specific policy
  #   rswitch - allow role switch
  #   hold    - allow hold mode
  #   sniff   - allow sniff mode
  #   park    - allow park mode
  lp rswitch,hold,sniff,park;
}
Pada opsi name = SERVER itu terserah dari Anda untuk menentukannya. Disini passkey tidak diperlukan karena bluez-utils sudah versi 3.x yang menggunakan passkey-agent. Bukan lagi menggunakan pin-helper, pin. Untuk lebih jelasnya bisa di baca dari referensi Distro Gentoo yang linknya ada di Credit dibawah.

Restart / Jalankan service bluetooth
# /etc/init.d/bluetooth restart
Jika di dapati saat melakukan perintah hciconfig -a tidak bisa menampilkan secara sempurna bluetoothnya (seperti tampilan dibawah ini)
# hciconfig -a
hci0:   Type: USB
        BD Address: 03:00:30:04:4E:1E ACL MTU: 1017:8 SCO MTU: 64:0
        UP RUNNING
        RX bytes:145 acl:0 sco:0 events:18 errors:0
        TX bytes:320 acl:0 sco:0 commands:18 errors:0
        Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Can't read local name on hci0: Input/output error (5)
Penulis harus melakukan reset setiap kali menyalakan komputer
# hciconfig hci0 reset
 usb 1-1.2: USB disconnect, address 25
 usb 1-1.3: USB disconnect, address 26
Hasilnya kurang lebih harus seperti berikut
# hciconfig -a
hci0:   Type: USB
        BD Address: 03:00:30:04:4E:1E ACL MTU: 1017:8 SCO MTU: 64:0
        UP RUNNING PSCAN ISCAN
        RX bytes:561 acl:0 sco:0 events:39 errors:0
        TX bytes:650 acl:0 sco:0 commands:39 errors:0
        Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        Name: 'SERVER'
        Class: 0x3e0100
        Service Classes: Networking, Rendering, Capturing, Object Transfer, Audio
Kemudian kita harus mengetaui bluetooth dari HP kita dengan jalan
# hcitool scan
Scanning ...
        00:12:EE:B2:29:AD      Dick
Sekarang kita harus mengetahui service Dial Up Networking (DUN) dari HP kita berada di channel berapa dengan jalan mengetikkan perintah:
# sdptool search DUN
Inquiring ...
Searching for DUN on 00:12:EE:B2:29:AD ...
Service Name: Dial-up Networking
Service Description: Symbian OS,UIQ phone
Service Provider: Sony Ericsson
Service RecHandle: 0x10007
Service Class ID List:
  "Dialup Networking" (0x1103)
  Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
  Channel: 7
  Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
  Profile Descriptor List:
  "Dialup Networking" (0x1103)
  Version: 0x0100
Dari hasil diatas diketahui bahwa channelnya adalah 7 maka penulis merubah isi dari file /etc/default/bluetooth
.....snip hanya nampilin bagian dund saya ya ini .......
############ DUND
#
# Run dund -- this allows ppp logins. 1 for enabled, 0 for disabled.
#DUND_ENABLED=1

# Arguments to dund: defaults to acting as a server
#DUND_OPTIONS="--listen --channel 2 --msdun call ngage"

# Run dund --help to see the full array of options.
# Here are some examples:
#
# Connect to any nearby host offering access
# DUND_OPTIONS="--search"
#
# Connect to host 00:11:22:33:44:55
# DUND_OPTIONS="--connect 00:11:22:33:44:55"
#
# Listen on channel 3
# DUND_OPTIONS="--listen --channel 3"
DUND_OPTIONS="--connect 00:12:EE:B2:29:AD"
DUND_OPTIONS="--listen --channel 7"
edit file /etc/bluetooth/rfcomm.conf
#
# RFCOMM configuration file.
#

rfcomm0 {
# # Automatically bind the device at startup
bind yes;
#
# # Bluetooth address of the device
# device 11:22:33:44:55:66;
device 00:12:EE:B2:29:AD;

# # RFCOMM channel for the connection
# channel 1;
channel 7;

# # Description of the connection
# comment "Example Bluetooth device";
comment "Example Bluetooth device";
}
Restart bluetooth
/etc/init.d/bluetooth restart
Kemudian Untuk bisa melakukan pairing diperlukan aplikasi passkey-agent. Sayangnya file ini tidak tersedia langsung namun harus dikompilasi terlebih dahulu. Diperlukan dukungan file libdbus-1-dev untuk bisa mengkompilasinya (install jika belom ada)
cd /usr/share/doc/bluez-utils/examples
gunzip passkey-agent.c.gz
make passkey-agent.c
cp passkey-agent /usr/bin/
passkey-agent --default 1234 00:12:ee:b2:29:ad &
Passkey-agent ini sebenarnya cukup 1x saja setelah itu tidak lagi karena dah tersimpan di dalam /var/lib/bluetooth/ .Kemudian setting di wvdial.conf seperti berikut (Penulis menggunakan IM3 dari Indosat):
[Modem0]
Modem = /dev/rfcomm0
Baud = 57600
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
Init3 = ATM0
FlowControl = CRTSCTS

[Dialer IM3]
Username = gprs
Password = im3
Phone = *99#
Stupid Mode = 1
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","www.indosat-m3.net","",0,0
Inherits = Modem0
Setelah disimpan maka ketikkan "wvdial im3", Saat ditanyakan pairing kode di HP nya isikan 1234 sesuai dengan isian dr passkey-agent.
# wvdial im3 
--> WvDial: Internet dialer version 1.56
rfcomm_tty_ioctl: TIOCGSERIAL is not supported
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","www.indosat-m3.net","",0,0
AT+CGDCONT=1,"IP","www.indosat-m3.net","",0,0
OK
--> Sending: ATE0V1
ATE0V1
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
CONNECT
~[7f]}#@!}!}!} }9}#}%B#}%}(}"}'}"}"}&} } } } }%}&X*}3cD7~
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Thu Feb 14 10:31:40 2008
--> Pid of pppd: 7438
CSLIP: code copyright 1989 Regents of the University of California
PPP generic driver version 2.4.2
--> Using interface ppp0
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> local  IP address 10.35.7.202
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> remote IP address 10.64.64.64
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> primary   DNS address 124.195.15.100
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
--> secondary DNS address 124.195.15.98
--> pppd: p[02][06][08]P[02][06][08][01][06][08]
Dengan Kombinasi harga im3 saat ini(Rp. 1/kb) dan linux yang bisa chat / browse based console murah banget terasa internetan nya hehehe.
Credits:
- Dokumentasi Gentoo Bluetooth

Permalink logo del.icio.usadd to del.icio.us | view as pdfview as pdf