Tuesday, July 13, 2010

Using your mobile phone as internet gateway for your laptop running Ubuntu


Hello folks! I haven't blogged in years - what made me do so now? Two reasons - boredom and Anerudhan. The first reason made me keep whining to my friends how bored I am, how much I miss them all and the college life. And this, in turn, led to my pal Anerudhan almost coaxing me to blog again. That ends the (short) prelude; I'll get straight to what this particular blog entry is about.

________________________


A) Intro:-

Most of us (me and my friends) are soon gonna be off to different cities, far away from our homes. There might be times when we really need go online [connect to the internet] but can't find a nearby wireless access point. Or maybe it is password protected! [Hate that!, don't we?? ;)] The last resort is to head out to the nearest browsing centre.

However, as long as you have a mobile and a laptop, you might be able to browse from wherever you are (even if you're travelling by bus/train), as long as your mobile shows good signal strength [and you're willing to foot the GPRS bill on your mobile!]. This little how-to will take you step-wise through the process of setting up your phone as an internet gateway for your laptop running a Linux distro. Simply put, how to use your phone as an internet modem for your laptop.

* Tested using an Acer Aspire One D250 netbook, running Ubuntu 10.04 LTS - Lucid Lynx; a Nokia 5230 phone, using an Airtel prepaid SIM card; via Bluetooth connection between the two devices.

Many people are probably wondering, "Aww!! Why a Linux distro?? Why not Windows?" (Maybe even a Mac, I dunno!)

I don't like or use Windows; I like and use Ubuntu Linux and I haven't used a Mac in the past 8 years. Besides, there is almost certainly well-documented procedures and softwares already available for doing this on both Windows as well as Mac OS. Google should find them for you.

________________________


B) Preliminary info:-

Before we get to the phone-as-internet-gateway-for-laptop setup, I'm obliged to remind you that there are two ways of connecting your phone to your laptop - using the phone's USB cable or via Bluetooth. The first one is simpler and is sure to work on most phones. However, if your phone is Bluetooth-enabled and you don't want to use a USB cable, you could try the second method, which I personally think is 'cool'. :)

________________________


C) How-to - using your phone's USB cable:-

If you use the phone's USB cable, you probably won't need to do anything at all.

1. Just make sure your phone is turned on and connected via USB to your laptop, use the 'Phone mode' or 'PC Suite mode' when it asks on the phone.

2. Follow the setup wizard that pops up automatically for a 'New Mobile Broadband connection' and you're almost done. (If for some reason the wizard doesn't pop up automatically, click on the Network icon at the right side of the top-panel and you should find something like 'New Mobile Broadband (GSM) connection...', clicking on it should bring up the wizard.)

Note:- At the end of the wizard, it will automatically connect to your newly setup mobile broadband connection, have a look at the Network icon in the top-panel. If it doesn't connect automatically, the following step tells you how to do so manually.

3. Right-click the Network icon at the right side of your top-panel, click 'Enable Mobile Broadband', now click on the same Network icon and you should find something like 'Airtel Default' or 'AIRCEL Web' or whatever that you set up using the wizard in step 2. Click on it and you should be connected! Simple as that.

Go ahead and try google.com on Firefox. :D

Alternatively, if you don't like setup wizards, you could right-click on the Network icon, go to 'Edit Connections', click on the 'Mobile Broadband' tab and set up your connection there. This is the hard way of doing things, for those of you who take a liking to it. Setup wizards aren't for nothing - they make life so much easier!

________________________


D) How-to - using Bluetooth:-

Now, this is what this whole blog entry is really about! Using Bluetooth to connect your phone to your laptop, as an internet gateway.


D.1) To test whether a Bluetooth connection can be set up between your laptop and you phone:

1. Turn on Bluetooth on both the devices.

2. On your laptop, click on the Bluetooth icon that appears in your Notification area (right side of the top-panel) and go to 'Preferences'.

3. In the 'Bluetooth Preferences' window that appears, check 'Make computer visible', assign a 'Friendly name' (e.g. Bob's computer) and check 'Show Bluetooth icon'.

4. Ensure that your phone's Bluetooth is switched on (and set its visibility to 'Shown to all' if the option exists).

5. Next, click on the 'Set up new device...' button in the 'Bluetooth Preferences' window if you haven't closed it already or click on the Bluetooth icon in the Notification area and select 'Set up new device...'.

6. The 'Bluetooth New Device Setup' wizard should appear. Hit 'Forward'.

7. As long as your phone's Bluetooth is turned on and it is close to your laptop, it will get detected and displayed in the 'Device' list.

8. Select it by clicking on your phone's Bluetooth name in the list and hit 'Forward'.

9. A PIN will be displayed in the setup wizard window. Go to your phone and select 'Yes' for 'Accept pairing request?'. When the phone asks for the PIN, type in the PIN shown on the setup wizard window (and hit 'OK').

10. If everything went right, the setup wizard will say 'Setup Completed' and your laptop will be paired with your phone, making your phone's name appear in the 'Devices' list in the 'Bluetooth Preferences' window.

11. To test whether the devices have truly been paired up, try sending a file from your laptop to your phone by clicking on the Bluetooth icon in the Notification area and selecting 'Send files to device...'.


Now that we have successfully established a Bluetooth connection between your phone and your laptop, it's time to set up your phone as GSM modem for your laptop. For that, we need to install a small piece of software called 'blueman'. You can find instructions for its installation at http://www.blueman-project.org/downloads.html


D.2) Just for the heck of it, I'll guide you through the installation procedure on Ubuntu. (This installation procedure was tested on 10.04, should work on all versions though. If this isn't your Linux distro or if you have an older version of Ubuntu such that the following procedure doesn't work, you will have to follow the appropriate installation instructions for your OS from http://www.blueman-project.org/downloads.html)

1. Ensure that you are connected to the internet.

2. Fire up a Terminal (From top-panel, click on Applications --> Accessories --> Terminal)

3. In the Terminal, type in 'sudo add-apt-repository ppa:blueman/ppa' and hit Enter. (Type in only the text in between the single quotes and not the single quotes themselves!!)

4. You will need to type in your password. (I'm assuming that you have logged in as a user with admin privileges, which is true of the account you first create as you install Ubuntu.)

4. When you get the 'username@computername:~$' prompt in the Terminal again, type in 'sudo apt-get update' and hit Enter.

5. When you get the 'username@computername:~$' prompt in the Terminal again, type in 'sudo apt-get install blueman' and hit Enter.

6. Accept if it asks you whether you wish to install 'blueman' and its dependency packages. This is usually done by typing in 'y' or 'Y' (for 'yes') and hitting the Enter key.

7. Once the installation is complete, you will get the 'username@computername:~$' prompt in the Terminal again. Hit 'Ctrl+D' or type in 'exit' and hit Enter or just close the Terminal - there are so many ways of closing it!! :D

8. Turn on the Bluetooth on your laptop again and see if it shows two Bluetooth icons in the Notification area. One is your older icon and the other one is the new 'blueman' application that says 'Bluetooth Enabled'. If this doesn't happen, try turning on your laptop's Bluetooth after restarting your computer.

9. If you get the new 'Bluetooth Enabled' icon in your Notification area, then the 'blueman' application has been installed successfully!! Pat yourself on the back, you did it. [Oh yes, this is very much an integral part of this how-to!] :)


D.3) Configuring:

Click on the 'Bluetooth Enabled' icon in the Notification area and it will open up the 'Bluetooth Devices' window. Your phone's name (which you already paired up with your laptop) should appear in this window. Ensure that your phone's Bluetooth is turned on. Right-click on your phone's name, go to 'Serial Ports --> Dial-Up Networking'. Your phone will ask you 'Accept the connection request?', select 'Yes'. If all goes well, you will see some orange, green and blue colored signal strength indication bars appear by the side of your phone's name in the 'Bluetooth Devices' window.

At this point, your phone has been setup to be 'seen' as GSM modem by your laptop, via Bluetooth. This happens as soon as you plug in the phone's USB data cable to your laptop!! We just managed to do it with 'no strings attached'. :D

Click on the Network icon and you should find something like 'New Mobile Broadband (GSM) connection...', clicking on it will bring up the setup wizard. Hit 'Forward'. Select your country (e.g. India) and hit 'Forward'. Select your mobile service provider from the list (e.g. Airtel) and hit 'Forward'. 'Select your plan:' (e.g. Default) and hit 'Forward'. Hit 'Apply'. Your new GSM mobile broadband connection should now be established; try google.com on Firefox! :)

Note:- At the end of the wizard, it will automatically connect to your newly setup mobile broadband connection, have a look at the Network icon in the top-panel. If it doesn't connect automatically, the following section tells you how to do so manually.

________________________


E) Connecting and Disconnecting:-


E.1) Using USB:

When using a USB connection, keep the phone turned on, connect the USB cable between your phone and your laptop, use the 'Phone mode' or 'PC Suite mode' when it asks on the phone. Right-click on the Network icon in the Notification area, click 'Enable Mobile Broadband'. Click on the Network icon in the Notification area and click on 'Airtel Default' or 'AIRCEL Web' or whatever connection you had setup earlier using the wizard. This will connect your laptop to the internet using your phone as GSM modem. You can start browsing.

To disconnect after you're done browsing, click on the Network icon in the Notification area and click 'Disconnect' just below 'Airtel Default' or 'AIRCEL Web' or whatever. Then simply unplug your USB cable and you're done!


E.2) Using Bluetooth:

If you used the Bluetooth setup, turn on Bluetooth on your phone and your laptop. Click on the 'Bluetooth Enabled' icon in your laptop's Notification area and your phone will appear in the 'Bluetooth Devices' window that appears. Right-click on your phone's name, go to 'Serial Ports --> Dial-Up Networking'. Your phone will ask you 'Accept the connection request?', select 'Yes'.

After a few seconds, right-click on the Network icon in the Notification area, click 'Enable Mobile Broadband'. Click on the Network icon in the Notification area and click on 'Airtel Default' or 'AIRCEL Web' or whatever connection you had setup earlier using the wizard. This will connect your laptop to the internet using your phone as GSM modem. You can start browsing.

To disconnect after you're done browsing, click on the Network icon in the Notification area and click 'Disconnect' just below 'Airtel Default' or 'AIRCEL Web' or whatever. Simply turn off Bluetooth on your laptop and your phone, thats it!

________________________


You can now browse on your laptop/netbook running Linux using your phone's GPRS, wherever you have good signal reception on your mobile. You never know when this setup might come in handy. (who knows, maybe even 'save your day' some day!) A few tips are in order.

a) Turning off images on your browser reduces the amount of data transferred per web page and also loads them much faster.

b) Many mobile service providers offer prepaid GPRS packs such as INR 5 for 50MB, valid 24 hours on Airtel (dial *555*2#), INR 98 for 2GB, valid 30 days on Airtel, etc. They work out MUCH cheaper than the normal GPRS usage charges.

c) When using Bluetooth connection between your laptop and your phone, ensure that they are within range (~10 m), the closer the better - as this could lower the transmit/receive power levels for your devices and thus save your batteries.

What're you waiting for?? Go out and flaunt your new contraption to all your friends now! [and your girlfriend if you're (un)lucky(?) enough to have one; or try to impress your crush with it, if she's the kind who likes geeks!! ;)]

I hope I've covered everything accurately. If you need any clarifications or have any corrections/suggestions/etc. to his how-to, please leave them in the comments section. And of course, please leave your comments there too! Until next time, adieu. :)