Kenya, Miscellaneous

Nokia 2630, Linux, Bluetooth, Safaricom, and You!

I bought a Nokia 2630 phone a few weeks ago. It has Bluetooth and GPRS, the latter meaning that I can browse the net on the go. The former plus the latter meaning that I can browse the net from my computer via the phone using the Bluetooth. I got it working in a few minutes on my Zenwalk (Slackware) laptop, and now you can too!

A lot of the Bluetooth/Linux/GPRS tutorials are a bit old and use a few things which will really mess you up, like pppd and chat scripts, PIN numbers, and pand. Let me just tell you: you don’t need any of that stuff. You need a working Bluetooth stack, userland Bluetooth tools (BlueZ), wvdial, and pppd, all of which should come on any recent GNU/Linux distribution. I’ve tried this on Ubuntu 8.10 and it took less than two minutes to get working. I use Slackware because I like to do everything myself, but I’m going to assume you’re on Fedora, SuSe, Ubuntu, etc, and skip all the painful details.

First things first, make sure your phone’s Bluetooth is turned on. The next step is to establish a serial connection over Bluetooth with your phone. In order to connect to the phone you’ll need to find it’s address—use hcitool to scan for Bluetooth devices:

$ hcitool scan
Scanning ...
            00:13:E4:7D:2E:42       Breeee

My sample scan shows my phone’s name and address; don’t ask what my phone’s name means, haha. Now you have to edit the /etc/bluetooth/rfcomm.conf file. If it doesn’t exist, create it. If it exists, change the settings to match your phone:


#
# RFCOMM configuration file.
#

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

        # Bluetooth address of the device
        device 00:13:E4:7D:2E:42;

        # RFCOMM channel for the connection
        channel 1;

        # Description of the connection
        comment "Nokia 2630 DUN";
}

If you have a Nokia phone the channel should be 1, you can make sure by using sdptool to check the capabilities of your phone. The command should be sdptool browse 00:13:E4:7D:2E:42, but of course use your phone’s address. That command should output a lot of text, but you’re only interested in the “Dial-up Networking” section. Confirm the channel number and then make the appropriate changes to the rfcomm file above.

Next comes the configuration of the computer’s PPP settings. Wvdial makes using PPP painless. Open up /etc/wvdial.conf and add the following:

[Dialer Defaults]
Phone = *99#
Username = doesnt
Password = matter
Stupid Mode = 1
Dial Command = ATDT

[Dialer nokia]
Modem = /dev/rfcomm0
Baud = 115200
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
Init4 = AT+CGDCONT=1,"IP","SAFARICOM"

Before connecting to Safaricom we have to create the “serial” (radio) link with the phone (device 0 from /etc/bluetooth/rfcomm.conf):

$ sudo rfcomm bind 0
$ rfcomm
rfcomm0: 00:13:E4:7D:2E:42 channel 1 clean

You should see rfcomm0’s status as “clean.” You will only have to rebind after a reboot, sleeping or walking away from the computer with the phone will not affect the bind. Now use wvdial to connect to the phone and dial the ISP:

$ sudo wvdial nokia
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","SAFARICOM"
AT+CGDCONT=1,"IP","SAFARICOM"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Sun Dec 21 19:47:21 2008
--> Pid of pppd: 1103
--> Using interface ppp0
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> local  IP address 172.27.23.229
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> remote IP address 10.6.6.6
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> primary   DNS address 196.201.208.2
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
--> secondary DNS address 209.244.0.3
--> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]

You should see a lot of gibberish like this, and that means it worked. You may have to add the two DNS addresses to your /etc/resolv.conf if your Linux distribution’s pppd doesn’t add them automatically (mine doesn’t, and I never bothered to figure it out). I hope some of this was helpful.

Links that helped me: http://ubuntuforums.org/showthread.php?t=651852

23 Comments to “Nokia 2630, Linux, Bluetooth, Safaricom, and You!”

  1. Daggi

    Hallo allan. Hows ukambani stumbled upon your site and have been trying to configure my 2630 on ubuntu 8.04 bu am getting an error connection refused when calling “sudo wvdial nokia”. My rfcomm is as you indicated and my wvdial is purely like yours and also i have enable auto connect on the phone and marked it as trusted on ubuntu. so it cant be authentication issues. Assist!!

    1. Alan Author

      Daggi,

      Make sure your phone is not already using the EDGE connection (put the phone’s setting to “Connect when needed”). Is that what you meant by “auto connect?”

      Also, when you dial with wvdial your phone should say “Connected to _____” Did you see anything like that?

      I only tested in Ubuntu 8.10 while booted to the live CD. I’ll try again and see if there is another step I missed for Ubuntu.

      Alan

  2. Peter Waa

    Hi Alan,

    Many thanks for the write-up.

    I am unable to connect to with Fedora 10, I keep getting the following error message…

    [root@dev waa]# wvdial bluetooth
    –> WvDial: Internet dialer version 1.60
    –> Cannot get information for serial port.
    –> Initializing modem.
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    OK
    –> Sending: AT+CGDCONT=1,”IP”,”WEB.SAFARICOM.COM”
    AT+CGDCONT=1,b [1d]IPb [1d],b [1d]WEB.SAFARICOM.COMb [1d]
    ERROR
    –> Bad init string.
    –> Cannot open /dev/rfcomm0: Input/output error
    –> Cannot get information for serial port.
    –> Initializing modem.
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    OK
    –> Sending: AT+CGDCONT=1,”IP”,”WEB.SAFARICOM.COM”
    AT+CGDCONT=1,b [1d]IPb [1d],b [1d]WEB.SAFARICOM.COMb [1d]
    ERROR
    –> Bad init string.
    [root@dev waa]#

    Can you figure out what the problem could be?

    Best Regards,
    Peter Waa.

    1. I just pasted this config to an Ubuntu netbook I am working on, and I got the same error. In my case it was that the blog uses some different characters which wvdial doesn’t like, namely the “pretty” quotes around the IP and SAFARICOM. Replace them with normal quotes and it should work.

  3. teknosavvytom

    cool it worked with my nokia 2630!!!
    Really the Linux/GPRS/Bluetooth forums r old but urs helped
    Thankx a lot…

  4. Soulstar

    Peter, you’re missing the *99#- the number your phone has to dial to initialize a gprs connection. Allan, not a bad job done- but this kind of knowledge should be rudimentary to any linux user, lol. Anyway, good work:-).

  5. I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.

  6. Touhid

    hi im new to linux
    i v installed fedora 10
    i have use nokia 2630 as modem via bluetooth on both xp an vista
    but im having trouble to do that on my fedora10
    i edited ext/bluetooth/rfcomm.config but when i tried saving it, this is what it said
    The document could not be saved, as it was not possible to write to /etc/bluetooth/rfcomm.conf.

    Check that you have write access to this file or that enough disk space is available.
    For file /etc/bluetooth/rfcomm.conf no backup copy could be created before saving. If an error occurs while saving, you might lose the data of this file. A reason could be that the media you write to is full or the directory of the file is read-only for you.

    but i think im the main user for i installed it and only i use it
    please some1 help

    and iv installed the fedora in a drive with about8 gb and there are still more than 2 gb free
    i alos tried changing the permision of all kinds lf user to read write and…
    but when i press ok to save the permision setting it changes back

  7. Touhid

    i discovered that i cannot edit or delete anything from the root drive
    can any1 tell me y?
    could it b anything wrong i did while the system installation?
    i installed fedora on logical drive
    could that b any problem?
    please some1 help
    i badly wanna use internet on fedora using my 2630 via bluetooth

    1. Alan Author

      Touhid,

      You need to read about Unix and Linux permissions. You probably forgot to edit the rfcomm.conf file as root. You see, in Linux you must be the “root” user to edit most files outside of your home directory. Good luck.

  8. Atul

    I tried each step exactly the way you explained and the EDGE connection gets activated still I am not able to browse the internet. Can you suggest me of the possible reasons? The messages that I get are:

    –> WvDial: Internet dialer version 1.60
    –> Cannot get information for serial port.
    –> Initializing modem.
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    OK
    –> Sending: AT+CGDCONT=1,”IP”,”www.e.pr”
    AT+CGDCONT=1,”IP”,”www.e.pr”
    OK
    –> Modem initialized.
    –> Sending: ATDT*99#
    –> Waiting for carrier.
    ATDT*99#
    CONNECT
    ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}”}&} }*} } g}%~
    –> Carrier detected. Starting PPP immediately.
    –> Starting pppd at Mon Nov 2 05:10:21 2009
    –> Pid of pppd: 2405
    –> Using interface ppp0
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> local IP address 10.6.52.1
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> remote IP address 10.6.6.6
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> primary DNS address 218.248.240.23
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]
    –> secondary DNS address 218.248.240.79
    –> pppd: Ðk[06][08]Ðk[06][08]lentÜk[06][08]

    1. Alan Author

      That’s ok, you’re almost there. What you need to do is add the DNS servers to /etc/resolv.conf! Your wvdial output has two DNS addresses, place them in /etc/resolv.conf like this:
      nameserver 218.248.240.23
      nameserver 218.248.240.79

      Then you should be able to browse just fine. Good luck.

  9. Atul

    I installed blueman (now available in the repository) with the command:

    yum install blueman

    and it works like a charm. Slowly linux is gaining popularity and is reaching towards linux challenged people too.

    1. Alan Author

      Great idea. Blueman really simplifies the detection and pairing of devices. You can always pair the phone with Blueman and then dial with wvdial.

  10. Everything is working fine with command line.but when once disconnected it gives the error:—

    [root@localhost kuldeep]# wvdial nokia
    –> WvDial: Internet dialer version 1.60
    –> Cannot open /dev/rfcomm0: Device or resource busy
    –> Cannot open /dev/rfcomm0: Device or resource busy
    –> Cannot open /dev/rfcomm0: Device or resource busy

    how to release this so that i can connect to phone without restarting..??

    and one more thing how to connect through blueman.i have fedora 12 and blueman installed..but i cannot connect to phone with Dial up option..how to integrate this with network manager…?

    1. Alan Author

      Yes, what you can do is disconnect the rfcomm connection (rfcomm release 0) and then rebind it. Also, I find that if sometimes I need to reboot my phone, as if the Edge/3G connection on there is busy and can’t disconnect. Good luck.

  11. Rmd

    It didn’t work for me..when i enter “sudo wvdial nokia” in the terminal, i got the error:
    –>Cannot open /dev/rfcomm0: Connection refused
    I just follow all the instructions you’ve said above..any HELP..by the way, i’m using fedora10

  12. german ochoa

    well this is my xperience with wvdial in Debian Lenny 5.0.5
    1. first, before starting up your computer plug in the modem or the device
    2. then as root or sudo su user type “wvdial &” no matter if it shows the message “Cannot…” if you see
    local IP address ….
    remote IP address ….
    primary DNS address ….
    secondary DNS address ….
    at the end of the dial-up message, like some user showed above, your are already connected but
    3. make sure it’s using the ppp protocol to connect, in Debian it’s
    System>Administration>Network
    disable other connections except the point-to-point one
    OR simply restart your network
    /etc/init.d/networking restart
    as a tip ping to any web site, if you see an ip different from that assigned to your pc like above
    local IP address ….
    it means that it’s not using the modem or device to connect so you know what you can do.
    4. if you finally got connected and ,after so many days and nights of addictive downloading and getting knowledge, want to stop the connection just, as root or sudo user, type
    killall wvdial
    killall will stop any program or process by its name
    type it until you see the message ‘no process to kill’
    that’s it, this is how it always works for me, i’m a proud Debian user, it was a pleasure to show you my how-to

  13. Atul Potdar

    I am in the process of validating this connection on Linux (fedora); in the sence I assume that the bluetooth adapter is supported by the bluetooth stack and both the stack and adapter support the bluetooth profiles used by the Nokia phone. Have you tried this ? Any inputs from you are valuable. Thank you. Your write up on Nokia, gprs, linux, usb and you is being tried by me as an alternative to the bluetooth adaptation which may not be correct if the stack, adapter and nokia (or any other cell phones) are not compatible.

    I did try the BT connection and now in the process of trying the usb alternative for the above mentioned reasons. Thank you.
    Please respond.

Comments are closed.