Ubuntu Lucid Lynx Mobile broadband tethering to Nokia N95 Part 2

In part 1, wired USB tethering is explained. In this part 2, we will continue with wireless bluetooth tethering.

Wireless tethering in Ubuntu 10.04 (Lucid Lynx)

First, you need to pair the mobilephone to the Ubuntu PC. Once bluetooth pairing is completed, keep the mobilephone’s bluetooth in “visible mode” for the remaining of the steps below.

Scan for the bluetooth modem

In your Ubuntu PC, open a terminal window and run this command:

hcitool scan

It will take a few seconds to scan, and reply with something like this:

00:11:22:33:44:55	N95

The first part is the mobilephone bluetooth’s MAC address; note this down.

Reminder:
If there is no reply to the command, please make sure bluetooth on your mobilephone is in “visible mode”.

Next, run this command, but using the MAC address you got previously:

sdptool browse 00:11:22:33:44:55 | \
grep -A 10 Dial-Up | grep Channel

It will reply with something like this:

Channel: 4

This is the Bluetooth channel for the dial-up networking, i.e. the serial modem channel. Note this down as well.

Setting bluetooth modem configuration

Edit the file /etc/bluetooth/rfcomm.conf with root privilege:

gksudo gedit /etc/bluetooth/rfcomm.conf

Add these lines to the bottom of the file, but using the MAC address and the channel you got previously:

rfcomm0 {
	# Automatically bind the device at startup
	bind yes;

	# Bluetooth address of the device
	device 00:11:22:33:44:55;

	# RFCOMM channel for the connection
    	channel	4;

	# Description of the connection
	comment "Nokia N95";
}

Save and close the file.

Activate connection to bluetooth modem

You are now ready to activate connection to bluetooth modem.

sudo rfcomm connect 0

It will ask you to enter the administration password and display the following message:

Connected /dev/rfcomm0 to 00:11:22:33:44:55 on channel 4
Press CTRL-C for hangup

Keep the terminal running and do not press CTRL+C at this time. If you take a look at your mobilephone, you should see that the “bluetooth on” icon has been changed to a “bluetooth connected” icon.

Use Network Manager to activate broadband connection

Without the connection to the modem, there is no available mobile broadband network in the Network Manager.

Network Manager: no network available

Once connection to modem is made as described in previous section above, the available mobile broadband network will be listed in the Network Manager.

Network Manager: network available

Note that the entry “SingTel” above is the same one created in part 1. Therefore, follow the same steps to create the network for your mobile broadband service provider, if you have not already done so.

Subsequently, simple left-click on the Network Manager icon, and select the corresponding mobile broadband network. After a few seconds, you should see the “Connection Established” notification. That’s it! You are now online.

Deactivate broadband connection

To deactivate the connection, do the reverse. Left-click on the Network Manager icon, select “Disconnect”.

Network Manager: disconnect

You should see the “GSM network offline” notification.

Network disconnected

Now, go back to the terminal where the modem connection was made, and press CTRL+C to deactivate the modem connection. If the deactivation is successful, you should see the “network offline” notification.

Network disconnected

Futhermore, if you take a look at your mobilephone, you should see that the “bluetooth connected” icon has been changed back to a “bluetooth on” icon.

If the network does not go offline, run this command:

sudo rfcomm release 0

Automated script

It feels inelegant to be typing command lines into a terminal every time I need to tether via bluetooth; therefore, I created a script to automate this process. But that is a topic for Part 3.

Comments 14

  1. g.ahmad wrote:

    how to make ubuntu lycid a handsfree interface for N95 mobile ie use the pc mic and speaker with mobile..

    Posted 26 Oct 2010 at 1:46 am
  2. chewearn wrote:

    hi ahmad
    Thanks for reading. Unfortunately, I do not know the answer to your question.

    Posted 26 Oct 2010 at 9:44 am
  3. Kieth Swaney wrote:

    Ubuntu 10.04 LTS, Tmobile on a Motorola V3xx razr.

    1. Successfully paired (confirmed by backing up several files).
    2. grepped and modified the rfcomm successfully.
    Upon trying to connect, I get a minor error: “Syntax error line 18″ (actually line# 18 is blank…) But it connects successfully.
    3. Left click on “Network Manager” icon does not show the category “Mobile Broadband” (using Bluetooth, not USB; with USB, it does show the category).
    4. Sunk.

    I have successfully used this phone with Xandros (EeePC’s original OS- flavor of Linux) paired via Bluetooth. It seems I’m missing some step?

    Also, it appears from your method here, that one must keep a terminal window open (perhaps minimized) the full time on is ‘online’ via bluetooth? Is there another ‘painless’ way? Something like….enable bluetooth, pair, then just right click on the name of the phone on a list and select to go online?

    Posted 02 Dec 2010 at 1:00 am
  4. chewearn wrote:

    hi Kieth
    I am not sure what could be the issue. Perhaps, you could try create a mobile broadband entry manually, by right click on the Network Manager, select “Edit connection”, go to the Mobile Broadband tab, and click “Add” button.

    Yes, the method described in this post will leave a terminal window opened. However, you can avoid this by running “gksudo rfcomm connect 0″ through the run dialog (ALT+F2).

    Actually, I have written a BASH script to automate the process, together with a few udev rules providing feedback via notify-osd. But I have be tardy in writing up Part 3 of the Mobile Broadband Tethering article. Sorry about that, will try to get on it one of these days. :)

    Posted 02 Dec 2010 at 9:33 pm
  5. Robert S wrote:

    To automate this task:

    $ sudo lsusb
    Bus 003 Device 012: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

    $ sudo nano /etc/udev/rules.d/99-bluetooth-custom.rules

    # Enter into file (copy in idVendor and idProduct):
    ATTR{idVendor}==”0a12″, ATTR{idProduct}==”0001″, RUN+=”/usr/local/sbin/connect-bluetooth”

    Create :

    $ nano /usr/local/sbin/connect-bluetooth
    #!/bin/bash
    sleep 5
    /usr/bin/rfcomm connect 0 >> /tmp/bluetooth.log &

    Make file executable:
    $ sudo chmod +x /usr/local/sbin/connect-bluetooth

    Plug in your bluetooth!

    Any suggestions/enhancements would be appreciated

    Posted 15 Dec 2010 at 5:06 am
  6. chewearn wrote:

    hi Robert
    Thanks, that’s a nifty method! :)

    One feedback though, when you want to connect on demand rather than automatically each time bluetooth dongle is plugged in.

    In my case, I don’t always want bluetooth DUN to be activated each time. Sometimes, I use the bluetooth for file transfers to/from the phone only.

    Secondly, you perhaps also need a way to free up rfcomm (disconnect) when the bluetooth dongle is removed. I’m not sure, but I think /dev/rfcomm* will turned into a “phantom” entry if you simply unplug it. I have this problem occasionally if I don’t remember to reverse the “rfcomm connect” with a “rfcomm release”. It’s not a huge issue, just something to keep in mind.

    Posted 15 Dec 2010 at 8:46 pm
  7. Robert S wrote:

    AFAICS the device /dev/rfcomm0 disappears when the bluetooth is unplugged. This recipe is sufficient for my needs. I daresay it would be easy to do scripts with desktop icons to connect and disconnect the connection. My old eeepc setup had a script that automated the bluetooth device and channel number but I haven’t bothered to do this. If anyone is interested I could post it – it used a KDE desktop so would need to be adapted to Gnome.

    Posted 16 Dec 2010 at 7:11 pm
  8. chewearn wrote:

    hi Robert, thanks for the follow-up.

    Posted 16 Dec 2010 at 9:22 pm
  9. Janette wrote:

    Please can someone help me. I updated to 11.04 but the bluetooth doesn’t show in the network manager. I have done the above instructions but after doing sudo rfcomm connect o it tells me Cant find a config entry for rfcomm o.
    Has anyone any instructions to fix this please, I am new to Linux and appreciate the simple instructions above.
    Many Thanks…

    Posted 19 Sep 2011 at 3:43 pm
  10. chewearn wrote:

    Hi Janette, I am not up to date on Ubuntu 11.04. I don’t know if anything has changed since this page is written for 10.04. But maybe it is not so complicated. Do you by any chance use alphabet “o” instead of number zero in the “sudo rfcomm” ?

    Posted 19 Sep 2011 at 4:42 pm
  11. Janette wrote:

    Hi Chewearn I didn’t know which one to use so tried both. but will try it again. Thanks.

    Posted 19 Sep 2011 at 7:23 pm
  12. Janette wrote:

    No used the number zero and get same message :(

    Posted 19 Sep 2011 at 7:29 pm
  13. chewearn wrote:

    Okay, perhaps you need to backtrack and verify the “/etc/bluetooth/rfcomm.conf” file has the correct entry for rfcomm0. And it should be number zero, not alphabet “o”.

    Alternatively, make sure your Ubuntu installation is up to date. If not, get it fully updated and try again.

    If still not working, then I guess a lot has changed since 10.04 to 11.04, and unfortunately, I am no longer able to help you out.

    You could try post a help thread in ubuntuforums.org and hope someone with enough knowledge can help you out there.

    Posted 19 Sep 2011 at 9:06 pm
  14. Janette wrote:

    Hi, thanks for your help.
    That didn’t seem to work so I will continue to hunt!
    Thankyou.

    Posted 20 Sep 2011 at 9:42 am

Post a Comment

Your email is never published nor shared. Required fields are marked *