Linux And Mobile Internet

Linux goes mobile Normally I have Wifi coverage in about 90% of all the places I go to. In the remaining 10% I'll have to cope with 4G, 3G or GPRS coverage using my flat fee mobile subscription.
Using my Nokia phone as a mobile modem was not really a problem with Windows. However I am gradually switching over to Linux for various reasons (Do I really have to explain why? Can't you guess?). But how do you connect a Linux computer to a mobile phone?
We were about to go on holiday and I wanted to take my EEE-PC 900 with me. My EEE was running Easy-Peasy 1.1 at the time. It was a lot better than the original Xandros for sure and more complete. Connecting this system to the internet using my Nokia phone as bluetooth modem wasn't as difficult as I expected it to be. It's not all point a click like in Windows, it still needs some work in terminal mode, but you don't need to be a professor in computer science to get it going.

Let's switch off our wireless connection and let's get truly mobile. Oh, wait, you'll need some internet connection to download a few necessities first. After that it's a good idea to switch wireless internet off.

Phone And Subscription

My mobile phone :-) The first thing you'll need is a mobile phone with the proper data plan. Most modern phones can be used as a bluetooth modem, if your telco hasn't disabled it. Here I only describe how to connect phones which use the DUN protocol, like Nokia phones do. Windows Mobile phones use the PAN protocol, which is obviously different. I have no idea how to connect those.
Be sure you'll get yourself a flat fee data plan. Don't blame me if your phone company charges you a lot of money because you've got no or the wrong data plan. Also read the small print regarding the fair use policies. And don't use it abroad (until the EC is ready lowering the prices to an acceptable level).

Warning: In Holland it is quite common to get a free phone with your mobile subscription. Such phones can connect to and browse the internet. However it is quite possible that you won't be able to use that phone as modem because telco companies want to sell you a separate subscription for mobile internet for your computer.
The only way for you to find out whether this applies to you is to try it, or ask the helpdesk of your provider.

Bluetooth

Bluetooth dongle Most laptops come with a bluetooth adapter built in nowadays. Alas my EEE-PC 900 was about the last model to be shipped without it. Not to worry, a simple Sitecom USB dongle is all you need if your computer has no bluetooth either. It only sticks out about 1 cm. Unfortunately this is just too much to make the EEE fit in its pouch comfortably.
I'm not sure if the system has installed the necessary bluetooth drivers by itself, or if the bluetooth drivers were installed per default. If your drivers aren't installed automatically, you'll have to install the bluez library yourself. This is usually a matter of typing "bluez" in your Linux package manager and mark it to be installed.

System tray

When you see the little bluetooth icon in your system Notification Area when the bluetooth dongle is inserted, you're ready to continue to the next step.

Connecting Your Phone

Connecting It goes without saying that you'll have to connect your phone before you can communicate with it. You can connect either way: Let your computer discover your phone, or let your phone discover your computer. Be sure to set the receiving device in discovery mode, otherwise you'll have to wait for ever.
While you're there, this is the time to to make a note of your phone's MAC address, you're going to need it in a minute.

Usually your phone has an option to allow the connection between the two devices to be established automatically in the future. If not, you'll have to grant permission to connect every time you want to connect to the internet.

rfcomm.conf

So far so good. Now we need to edit a script. This has to be done as super user because ordinary mortals are not allowed to save to this file. Open a terminal screen. If you're familiar with terminal editors like vi, vim, emacs, nano or pico (or any other) you can simply type:

sudo nano /etc/bluetooth/rfcomm.conf

Replace nano with the editor of your choice of course. If you'd rather use a graphical editor type:

gksudo gedit /etc/bluetooth/rfcomm.conf

In either case you'll have to enter your password to authenticate yourself to the system as super user. Don't be alarmed if nothing appears to happen while you type your password in the terminal, it's normal that it is not echoed back to you?

The file you're editing will look something like the text below. All you have to do is to fill in the blanks. Most of the things are already there, you'll have to uncomment the important lines and probably change some values. I had to change bind to yes, and channel to 2. And don't forget to uncomment the last line, before the closing }. The only thing that must be different in your case is the phone's MAC address, and probably the comment line.

#
# RFCOMM configuration file.
#

rfcomm0 {
#	# Automatically bind the device at startup
bind yes;
#
#	# Bluetooth address of the device
device 00:21:FE:8F:20:E8;
#
#	# RFCOMM channel for the connection
channel	2;
#
#	# Description of the connection
comment "Nokia E61";
}

You can use this same file to setup the system for more than one phone by copying the entire text and change the second entry to rfcomm1, or whatever.

Now you'll have to let rfcomm make the connection. You can do that by hand by running sudo rfcomm connect rfcomm0 from the terminal. Or you can simply restart the PC, which will do that automatically for you.

Gnome-PPP

Go to your package manager and install Gnome-ppp, or KPPP. After that, run Gnome-ppp, which can normally be found in the Internet application menu. Click the Setup button. In the device field enter /dev/rfcomm0. It's no use trying to search for the device, it won't be found. You'll have to enter its name by hand.
The rest of the settings can remain as they are, at least in my case.

Gnome-PPP Enter the user name and password which you have received from your mobile operator. Most operators don't require a user name or password though. I simply entered something, gprs for user name and password in this case.
Enter *99# as phone number and you're done.

If all's well you can now connect to the internet. But before you do, switch off your wireless connection now, otherwise you won't know whether it works or not. You'll briefly see the text Dialing and a few moments later you are connected.

Make sure you, as user, may connect using ppp. In System - Administration - Users And Groups select properties and tick the box next to Connect to Internet using a modem.
You may have to log out and log in again to apply the new settings.

What to do if you can't connect? Well it could be anything. Have you entered everything as mentioned here? Pay particular attention that you have removed all the leading spaces before the keywords in /etc/bluetooth/rfcomm.conf!
Maybe your operator requires you to enter something specific in the user name and password fields. I know for instance that Vodafone wants you to enter vodafone in both fields.
PPP running Maybe your operator has disabled modem functionality in your phone. Or you are running a different flavour of Linux which doesn't meet all the requirements.
As always it is difficult to anticipate everything that could go wrong. You'll have to do some trouble shooting on your own and perhaps google around a bit to find the answer to your particular problem.

NetworkManager, Firefox and Pidgin

If everything went OK you are now connected to the internet through your phone. However starting Firefox 3 or the popular messenger program pidgin will present you with a nasty surprise. They simply don't work.

It's quite simple to get Firefox going, it only switched itself to Offline mode. All you need to do is to switch it back online again. Open the File menu and untick the Work Offline box.
This will fix it, for now. However if you exit Firefox and restart it again it will again be offline. Some say it's a bug in Firefox, but that is not true, it's only an unwanted feature.

Unfortunately it is not possible to get pidgin to work in a similar way. For that you'll have to type another command in a terminal screen again. At the same time this will also fix the offline going of Firefox.
On Debian based systems like Ubuntu and Easy Peasy this can be done with the following command.

sudo /etc/init.d/NetworkManager stop

I have searched the internet for a more permanent solution, but failed to find one so far. The NetworkMananger doesn't communicate with ppp good enough, which causes this little problem.
Maybe a later version will solve the problem all together.

If you don't use pidgin, you can also fix the problem by changing a setting in the Firefox about:config screen. To do that enter about:config in your Firefox URL field. Now you'll have to promise Firefox to be careful, otherwise you won't get to the settings.
In the filter box type toolkit. Now double click on the line toolkit.networkmanager.disable. It's value should now change from false to true.
Restart Firefox now and you'll see that it will wake up online, every time.