Thursday, April 9, 2009

Light at the end of the Broadband tunnel


Speeds when viewing a high definition myspace.com video at 9pm Wednesday night in Nairobi....

Is it too farfetched to think someone was testing submarine fiber cable? Bring it on..

Wednesday, January 28, 2009

Safaricom 3G on Mandriva

Really my first 'hack" this year... havent had time really - but here i am.

Opened my laptop yesterday and decided - lets revive the fun with Linux... Am running Mandriva Linux 2008 Spring edition. Challenge for the day - connect to the internet through safaricom 3G.

On Skunkworks, it has been a very recurrent question - how do i configure safaricom 3g on fedora, Ubuntu 8.04/8.10 e.t.c. Interesting that no one asked about Mandriva - am i alone in using Mandriva? This is more of a "how I did it" rather than a "How to".

I remember seeing the option of GPRS/EDGE/3G when i was installing Mandriva somewhere - going to the control center and selecting "setup a new network interface" brings it up.. On clicking that, it requires the installation DVD - which i somehow misplaced... Steps from here on..


1. Install comgt and ppp
- Download rpm comgt-0.32-2mdv2008.0.i586.rpm and ppp-2.4.4-3.2mdv2008.1.i586.rpm
- Verify rpms and install

2. Go to Mandriva COntrol Center - create new connection - GPRS/EDGE/3G gives me - No device can be found for this connection type... OOPS WHAT NEXT???

Output of dmesg

[tito@localhost test]$ dmesg
.
.
.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new interface driver usbserial
drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
drivers/usb/serial/usb-serial.c: USB Serial Driver core
drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1
scsi 3:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
scsi 3:0:0:0: Attached scsi generic sg2 type 5
usb-storage: device scan complete
sr0: scsi-1 drive
sr 3:0:0:0: Attached scsi CD-ROM sr0


----------------------
3. Download and Install USB_Switchmode from here

USB_ModeSwitch is (surprise!) a small mode switching tool for controlling "flip flop" (multiple device) USB gear

Several new USB devices (especially high-speed WAN stuff, they're expensive anyway) have their MS Windows drivers onboard; when plugged in for the first time they act like a flash storage and start installing the driver from there. After that (and on every consecutive plugging) this driver switches the mode internally, the storage device vanishes (in most cases), and a new device (like an USB modem) shows up. Some call that feature "ZeroCD".

edit /etc/usb_modeswitch.conf (I had the Huawei E220 modem - just removed the ";" so mine reads as follows



[tito@localhost test]$ vi /etc/usb_modeswitch.conf
########################################################
# Huawei E220 (aka "Vodafone EasyBox II", aka "T-Mobile wnw Box Micro")
# Huawei E270
# Huawei E870
# and probably most other Huawei devices (just adapt product ID)
#
# Two options: 1. removal of "usb-storage" 2. the special control
# message found by Miroslav Bobovsky
#
# Contributor: Hans Kurent, Denis Sutter

DefaultVendor= 0x12d1;
DefaultProduct= 0x1003

# choose one of these:
DetachStorageOnly=1
;HuaweiMode=1



run the command usb_switchmode -W


[tito@localhost test]$ /usr/sbin/usb_modeswitch -W

* usb_modeswitch: tool for controlling "flip flop" mode USB devices
* Version 0.9.6 (C) Josua Dietze 2009
* Works with libusb 0.1.12 and probably other versions

DefaultVendor=0x12d1
DefaultProduct=0x1003
TargetVendor=0x0
TargetProduct=0x0
TargetClass=0x0
DetachStorageOnly=1
HuaweiMode=0
SierraMode=0
SonyMode=0

MessageEndpoint=0x0
MessageContent=""
Interface=0x0

usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 003 on 002
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 004 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device

Looking for default devices
Found default devices (1)
Prepare switching, accessing latest device
Looking for active default driver to detach it
OK, driver found ("usb-storage")
OK, Driver "usb-storage" successfully detached
-> See /proc/bus/usb/devices (or call lsusb) for changes. Bye


---------------------

4. Go to Mandriva Linux Control Center > Setup a new network Interface > GPRS\EDGE\3G
Choose network as safaricom
Choose settings as unknown / Edit manually
Enter the following settings
APN: Safaricom
Username: saf
password: data
Select Connect now..

and voila - connected..

5. Test...

tito@localhost test]$ ping google.com
PING google.com (74.125.67.100) 56(84) bytes of data.
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=1 ttl=238 time=749 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=2 ttl=238 time=770 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=5 ttl=238 time=823 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=6 ttl=238 time=753 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=7 ttl=238 time=753 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=8 ttl=238 time=743 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=10 ttl=238 time=733 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=11 ttl=238 time=733 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=12 ttl=238 time=743 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=13 ttl=238 time=743 ms


My connection timed out at one point


[tito@localhost test]$ ping google.com
PING google.com (74.125.67.100) 56(84) bytes of data.
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=3 ttl=235 time=759 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=4 ttl=235 time=1399 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=9 ttl=235 time=740 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=11 ttl=235 time=1020 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=13 ttl=235 time=800 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=14 ttl=235 time=1159 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=15 ttl=235 time=820 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=16 ttl=235 time=913 ms
64 bytes from gw-in-f100.google.com (74.125.67.100): icmp_seq=17 ttl=235 time=829 ms

--- google.com ping statistics ---
18 packets transmitted, 9 received, 50% packet loss, time 17279ms


and i had to re-connect the PPP connection..

6. Automate the usbmodeswitch for the type of device automatically so that you dont have to do that every time you plug it in, or everytime you rebooot
add a new line to /etc/dev/rules.d with contents

SUBSYSTEM=="usb", SYSFS{idProduct}=="", SYSFS{idVendor}=="", RUN+=""


example mine looks like this

[tito@localhost test]$ vi /etc/udev/ruled.d/45-playusb.rules
SUBSYSTEM=="usb", SYSFS{idProduct}=="0x1003", SYSFS{idVendor}=="0x12d1", RUN+="/usr/sbin/usb_modeswitch"

Speeds are very slow - maybe am on GPRS and not 3g... No way to know but it seems download results from speedtest.net to KDN reveal great local speeds - must be the international bottleneck!