Using Your Cell Phone as a Broadband Modem on Linux

Linux Tethered Internet Access Via Blackberry

Summary:

This guide seeks to aggregate and improve upon information I gathered from various sources in order to get PC internet access thru a Blackberry working on Linux. They were tested on a Blackberry 8703e, but should apply if generalized slightly for other devices – the important part for non-blackberry users would be how to use the configuration scripts described. Please refer to the bottom of the guide where I cite references which were huge in making this possible.

Introduction:

Tethering on the blackberry in Linux is not supported by any vendor, but there are open source packages which have developed to the point where support is pretty solid. The process one must go thru is unneccesarily complicated currently because documentation on the internet is fragmented and poorly organized. This guide details my experience on a Gentoo Linux system, but should apply equally to other distros.

Procedures:

The steps detailed here include all requirements for getting blackberry tethering working – including kernel and software configuration that is directly required. These steps presume you have a properly configured kernel and your system is running stable – you should already have wired ethernet working to establish a base level of networking functionality. The process of setting up tethered internet access in this guide will be broken down into 7 sections. The headings below detail Kernel Configuration, Required Packages, Installing Packages From Source, Testing Functionality, Running XmBlackBerry, Configuration Scripts, and Connecting To The Internet.

Kernel Configuration

If your running Ubuntu, you can disregard this section as Ubuntu has the kernel components needed already built in – this may be true for other distros also. As a starting point for the rest of us, let’s make sure our kernel has the necessary PPP support included. Navigate to /usr/src/linux in a terminal and run “sudo make menuconfig”. The options we need are under “Device Drivers—>Network Device Support—>”. Here we want to ensure “PPP support” and “PPP support for async serial ports” are build as modules – ensure they have an “M” next to them. If they were not already listed as Modules, you can exit menuconfig saving your changes then issue “sudo make menuconfig && sudo make modules_install” to recompile your kernel. When complete, copy your kernel from /usr/src/linux/arch/i386/boot/bzImage to /boot and name it whatever you want. Update grub.conf or menu.lst so that you have the option to boot into your new kernel after you restart. Now reboot into your newly compiled kernel.

Required Packages

These are the packages you need to install to get tethering working:

Barry 0.13

XmBlackBerry 0.3.0

According to the XmBlackBerry page, before installation you will need Xlt, OpenMotif, and libusb – some of which you likely already have installed. The latest stable versions of these packages worked well for me, and they are linked from the XmBlackBerry page.

Installing Packages From Source

Depending on your distribution, installing these packages from source may be required. If your package manager has an up to date version of the items listed above, install thru the package manager as it will likely be quicker/easier. If you already have a package installed, or you install thru your package manager, you are all set and do not need to compile from source.

If you have never installed a package from source and you need to, be aware that it requires that you have the appropriate compilers and development packages already installed. Look here at the “what you need” section and here for a basic overview of how to configure, compile, and install any source package.

If you encounter errors during manual installation, search google on the topmost error you received for assistance on getting the package installed correctly, or contact me for advice.

Testing Functionality

At this point, you should have all “Required Packages” above installed successfully. Before we move on we should blacklist the berry_charge module to ensure it isn’t loaded. If loaded, it would block our access to the device. To do this open /etc/modprobe.d/blacklist in your preferred text editor, and add the line “blacklist berry_charge” anywhere in the file.

At this point, we can go ahead and plug the Blackberry in with the USB cable. Once its connected, we can issue in the terminal “sudo btool -l” and it should find the device. Output should look something like this:

Blackberry devices found:
Device ID: 0x951b958. PIN: 32b9203d, Description: RIM 8700 Series Colour CDMA Handheld

Once the device is recognized, we are ready to run XmBlackBerry.

Running XmBlackBerry

To run XmBlackBerry you want to go to your terminal and issue the command “sudo /usr/local/bin/XmBlackBerry”. This will open the XmBlackBerry GUI and output messages to the terminal window – we need some information from the terminal window. The output will look like this:

mrb78s@l3kmya3 ~/Desktop $ sudo /usr/local/bin/XmBlackBerry

bb_usb.c:scan_device(1664) – bcdDevice 0104, 1 configurations

bb_usb.c:scan_device(1678) – Attempting magic to increase power to /proc/bus/usb/003/021, MaxPower 100mA

XmBlackBerry.c:OptionPopupCallback(998) – GPRS modem device Not available

bb_usb.c:scan_device(1664) – bcdDevice 0104, 1 configurations

bb_usb.c:scan_config(1618) – bConfiguration 1 MaxPower = 500mA

bb_usb.c:say_hello(486) – Read 0 bytes of 7 from ep 85. Didn’t hear hello. Resource temporarily unavailable No error

bb_usb.c:check_endpoint_pair(1435) – Couldn’t say hello

serdata.c:initialize(237) – pty name. “/dev/pts/2”

bb_usb.c:handle_sequence(117) – out of sequence. Got 0x00000002, expecting 0x00000001

Take a look at the first highlighted line above – it shows the device as not recognized because I clicked on the Options menu in XmBlackBerry before it was fully loaded and the device isn’t being picked up yet. That is what you will see if your device is not being recognized. Then, the second item highlighted appeared after I entered the device password and shows the device is recognized. Remember the device name listed here (/dev/pts/2) as yours could be different and we’ll need this for our config scripts later. If your ready to roll, you should see this device name.

Configuration Scripts

Now that our device is recognized by the computer, we need to configure our scripts for using the Blackberry as a modem. We installed Barry earlier, and with that package comes several example configuration scripts. We will make a couple customizations to these scripts and place them in /etc/ppp/peers/ and /etc/chatscripts/. To start, go to the directory where you extracted Barry and look at the files in the ppp directory. We will use the barry-verizon example – the barry-verizon file should be placed into /etc/ppp/peers/ and the barry-verizon.chat should be placed in /etc/chatscripts/. The chatscript does not need to be modified, but the barry-verizon peer file needs to have our device name and username/password input. Open the file in your preferred text editor and we will change 3 lines. First in the user line, input your phone number and domain name as shown – for Verizon phones, this is “[email protected]”. Refer to my linked sources below if you are with a different provider to find out the proper domain to use in your username. Second, in the password field enter your phone number. Finally, comment out the line “pty /usr/sbin/pppob” so that it looks like this “#pty /usr/sbin/pppob” – then right below that line input your device name. For example: /dev/pts/2

Your configuration files are now ready for you to connect. In the box below is an example of my /etc/ppp/peers configuration file, with comments explaining what each value means. These explanations come from the manpage for pppd. The lines that needed personalized are highlighted:

#
# This file contains options for Verizon Blackberries
#
# It is based on a file reported to work, but edited for Barry.
#
#connect script
# Usually there is something which needs to be done to prepare the link before the PPP protocol can
# be started; for instance, with a dial-up modem, commands need to be sent to the modem to dial the
# appropriate phone number. This option specifies an command for pppd to execute (by passing it to
# a shell) before attempting to start PPP negotiation. The chat (8) program is often useful here,
# as it provides a way to send arbitrary strings to a modem and respond to received characters. A
# value for this option from a privileged source cannot be overridden by a non-privileged user.
connect “/usr/sbin/chat -f /etc/chatscripts/barry-verizon.chat”

#name of blackberry device

/dev/pts/2

#noauth Do not require the peer to authenticate itself. This option is privileged.
noauth

#Authentication username/password with Verizon

user “[email protected]
password “5555555555”

#defaultroute
# Add a default route to the system routing tables, using the peer as the gateway, when IPCP negoti-
# ation is successfully completed. This entry is removed when the PPP connection is broken. This
# option is privileged if the nodefaultroute option has been specified
defaultroute

#usepeerdns
# Ask the peer for up to 2 DNS server addresses. The addresses supplied by the peer (if any) are
# passed to the /etc/ppp/ip-up script in the environment variables DNS1 and DNS2, and the environ-
# ment variable USEPEERDNS will be set to 1. In addition, pppd will create an /etc/ppp/resolv.conf
# file containing one or two nameserver lines with the address(es) supplied by the peer.
usepeerdns

#noipdefault
# Disables the default behaviour when no local IP address is specified, which is to determine (if
# possible) the local IP address from the hostname. With this option, the peer will have to supply
# the local IP address during IPCP negotiation (unless it specified explicitly on the command line
# or in an options file).
noipdefault

#nodetach
# Don’t detach from the controlling terminal. Without this option, if a serial device other than
# the terminal on the standard input is specified, pppd will fork to become a background process.
nodetach

#novj
# Disable Van Jacobson style TCP/IP header compression in both the transmit and the receive direction.
novj

#nocrtscts
# Disable hardware flow control (i.e. RTS/CTS) on the serial port. If neither the crtscts nor the
# nocrtscts nor the cdtrcts nor the nocdtrcts option is given, the hardware flow control setting for
# the serial port is left unchanged.
nocrtscts

#nomultilink
# Disables the use of PPP multilink. This option is currently only available under Linux.
nomultilink

#ipcp-accept-local
# With this option, pppd will accept the peer’s idea of our local IP address, even if the local IP
# address was specified in an option.
ipcp-accept-local

#ipcp-restart n
# Set the IPCP restart interval (retransmission timeout) to n seconds (default 3).
ipcp-restart 7

#ipcp-accept-remote
# With this option, pppd will accept the peer’s idea of its (remote) IP address, even if the remote
# IP address was specified in an option.
ipcp-accept-remote

#Added so we do not disconnect after a few minutes
lcp-echo-interval 0
lcp-echo-failure 999

#mtu n
# Set the MTU [Maximum Transmit Unit] value to n. Unless the peer requests a smaller value via MRU
# negotiation, pppd will request that the kernel networking code send data packets of no more than n
# bytes through the PPP network interface. Note that for the IPv6 protocol, the MTU must be at
# least 1280.
mtu 1492

#debug
# Enables connection debugging facilities. If this option is given, pppd will log the contents of
# all control packets sent or received in a readable form. The packets are logged through syslog
# with facility daemon and level debug. This information can be directed to a file by setting up
# /etc/syslog.conf appropriately (see syslog.conf(5)).
debug

#pty script
# Specifies that the command script is to be used to communicate rather than a specific terminal
# device. Pppd will allocate itself a pseudo-tty master/slave pair and use the slave as its termi-
# nal device. The script will be run in a child process with the pseudo-tty master as its standard
# input and output. An explicit device name may not be given if this option is used. (Note: if the
# record option is used in conjuction with the pty option, the child process will have pipes on its
# standard input and output.)
#pty “/usr/sbin/pppob”

#115200
#modem
#nodeflate
#nobsdcomp
#noaccomp
#default-asyncmap
#debug debug debug
#nopcomp
#nomagic
#passive

 

Connecting To The Internet Using The Blackberry As A Modem:

Thru the steps above, we are now fully configured and ready to connect. To connect, we first run XmBlackBerry to establish a connection with the device. Issue “sudo /usr/local/bin/XmBlackBerry” at a terminal and provide your device password if prompted by the GUI. Now, we go to a terminal window and type “sudo pppd call barry-verizon” to initialize the Blackberry as a modem and connect. This runs pppd to initiate the connection and tells it to call the script named barry-verizon from /etc/ppp/peers/. If you named your script something other than barry-verizon, be sure to specify the correct name.

Once the script runs, run ifconfig from the terminal and you should see an entry for ppp0 with an IP address. Congratulations – Your Connected!

Conclusion:

The setup process is somewhat involved, but once complete everything works great. Linux has come a long way in many regards, but this is one of those ugly processes whose development hasn’t come far enough to make things less painful yet. If you encountered problems at any part of the process, you may find further troubleshooting details at the sources linked below. Also, feel free to contact me with questions or for clarification.

IMOG – Matt Bidinger http://imog.us

References:

Netdirect – Using Your Blackberry As A Modem
Ubuntuforums Thread
Thibaut Colar’s Instructions
Blackberryforums Instructions

About Matt Bidinger 60 Articles
My name is Matt Bidinger. I manage the editorial and forum staff for Overclockers.com, and I enjoy Community Management with a number of large internet sites. I've worked in IT in my professional career; my site involvement keeps me off the streets at night. When relaxing, I can usually be found walking the parks and roads of Rootstown, OH with my wife Kim and my dog Bubba.

Be the first to comment

Leave a Reply